|
-
Feb 8th, 2005, 11:10 AM
#1
Thread Starter
Addicted Member
Deleting spaces in the middle of a sting [RESOLVED]
How do i delete spaces in the middle of a string?
I have txt box droping a value with a space into a string, but I need to stip the spaces from the middle of the value.
"New Record" needs to become "NewRecord"
Thanks in advance.
Last edited by DKasler; Feb 8th, 2005 at 01:35 PM.
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
-
Feb 8th, 2005, 11:14 AM
#2
Re: Deleting spaces in the middle of a sting
 Originally Posted by DKasler
How do i delete spaces in the middle of a string?
I have txt box droping a value with a space into a string, but I need to stip the spaces from the middle of the value.
"New Record" needs to become "NewRecord"
Thanks in advance.
Ok you can use the Split function and then the Join function
VB Code:
Dim tempArray() As String
Dim myString As String
tempArray = Split(Text1.Text, " ") 'remove the space and store each word in a rray
myString = Join(tempArray, "") 'join back together again
Text1.Text = myString 'display
for a full explination on these 2 function have a look in my sig and click on Useful Vb function
Hope that helps
-
Feb 8th, 2005, 11:43 AM
#3
Thread Starter
Addicted Member
Re: Deleting spaces in the middle of a sting
Thanks alot. That did EXACTLY what I needed.
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
-
Feb 8th, 2005, 11:49 AM
#4
Re: Deleting spaces in the middle of a sting
 Originally Posted by DKasler
Thanks alot. That did EXACTLY what I needed.
No problem glad to help, if you could mark this resolved and carry out any ratings 
Glad you solved it (I'm sure there is an easyer way of doing it I just cant remember)
Anyways glad its sorted.
Liam
-
Feb 8th, 2005, 12:19 PM
#5
Re: Deleting spaces in the middle of a sting [RESOLVED]
Eloquent solution squirrel man.
You could even make it more compact with
VB Code:
Text1 = Join(Split(X, " "), "")
...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|