CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    10

    Trimming a string?

    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


  2. #2
    Join Date
    Apr 1999
    Location
    Brooklyn, NY USA
    Posts
    171

    Re: Trimming a string?

    YourStrim = RTrim("YorString ") gives you YouString without leading spaces.



  3. #3
    Join Date
    May 1999
    Posts
    18

    Re: Trimming a string?

    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


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

Featured