|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
removing white space?!?!
Hi,
I am fairly new to ASP. I have made a feedback form script. BUT am having troubles removing whitespace from between names for emailing. The address is a variable. It works fine for addresses with one word. Having troubles and losing hair fast! thanks for your help in advance, cheerio Jax |
|
#2
|
|||
|
|||
|
Can you post an example of what you are trying to do exactly?
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#3
|
|||
|
|||
|
Thankyou for your response!
I have just worked it out myself Was looking for something like this... Do While InStr(1, GymAddress, " ") GymAddress = Replace(GymAddress, " ", "") Loop had names of gym from database but names had spaces... email addresses mailed to string var "GymAddress" are same as gym names without the spaces... thanks anyway - perhaps this can help someone else. Regs, Jax |
|
#4
|
|||
|
|||
|
If you were looking to get rid of all spaces then this would have been better:
Code:
Dim withSpaces, noSpaces As String
withSpaces = "this is some text with spaces"
noSpaces = Replace(withSpaces, " ", "", 1, -1, 1)
|
|
#5
|
|||
|
|||
|
Of Course the key piece is:
Replace(withSpaces, " ", "", 1, -1, 1) without having to loop. |
|
#6
|
|||
|
|||
|
In this case I need to trim white space usually 1 between words.
I also need to change street to st if it appears. This code below works: Do While InStr(1, GymAddress, " ") GymAddress = Replace(GymAddress, " ", "") Loop Do While InStr(1, GymAddress, "street") GymAddress = Replace(GymAddress, "street", "st") Loop you have suggested this alternative: Replace(withSpaces, " ", "", 1, -1, 1) could u please explain how this function works?!? ALSO can you point me to any good sites for this kind of information, or recommend any books. I have some experience with PHP and VB6.0. Thanks for your help!!! Jax |
|
#7
|
|||
|
|||
|
http://msdn.microsoft.com/library/d...sfctreplace.asp
Quote:
So essentially, this function if used with -1 in the count parameter will replace ALL occurances of the "find" parameter. |
|
#8
|
||||
|
||||
|
Using the function like
Code:
Replace(withSpaces, " ", "") |
|
#9
|
|||
|
|||
|
Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > removing white space?!?! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|