Results 1 to 3 of 3

Thread: Getting rid of trailing spaces....

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Question

    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

  2. #2
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    you can try using the "Trim" function...

    eg.

    Dim MyString, TrimString
    MyString = " <-Trim-> " ' Initialize string.
    TrimString = Trim(MyString) ' TrimString = "<-Trim->".


  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    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).
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width