-
Hello,
How do I get rid of trailing spaces in a string??
I have strings called strName and strSurname, which are populated by fields from a table.
The strName however has trailing spaces which I want to get rid of.
EG. I want to display the name & surname on a msgbox..
msgbox strname & " " & strSurname
the result must be something like.. "John Cooper" - without any spaces (except the one I specified) between the name & surname.
Thanks
-
you can try using the "Trim" function...
eg.
Dim MyString, TrimString
MyString = " <-Trim-> " ' Initialize string.
TrimString = Trim(MyString) ' TrimString = "<-Trim->".
-
exactely...
and when you only want to remove spaces from the left- or right side of the string also check out LTrim (LeftTrim) and RTrim (RightTrim).