Click to See Complete Forum and Search --> : Trimming a string?


ericJA
May 16th, 1999, 02:54 AM
I did a sql statement to select a user name.

Dim strName as String
...
...
The Access database has a text with a length being 128
however I selected a name "Sam Winston" which has a length less then 128. I get the following
info in strName

strName = "Sam Winston " up to 128 bytes.
Is there a way for me to trim of all the spaces after the last name so it looks like this:
strName = "Sam Winston"

Thanks

Vlad Chapranov
May 16th, 1999, 10:27 AM
YourStrim = RTrim("YorString ") gives you YouString without leading spaces.

MetalBoy
May 17th, 1999, 01:11 AM
strString = RTrim$(strString) 'will trim spaces on right
strString = LTrim$(strString) 'will trim spaces on left
strString = Trim$(strString) 'will trim spaces on both left and right