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.
Printable View
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 functionQuote:
Originally Posted by DKasler
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
Thanks alot. That did EXACTLY what I needed.
No problem glad to help, if you could mark this resolved and carry out any ratings :)Quote:
Originally Posted by DKasler
Glad you solved it (I'm sure there is an easyer way of doing it I just cant remember)
Anyways glad its sorted.
Liam
Eloquent solution squirrel man.
You could even make it more compact with
VB Code:
Text1 = Join(Split(X, " "), "")
...