Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: TRIM function?

  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TRIM function?

    Heres the situation:

    In my column in the database, the value is either "NEW" or "NEW "....notice the 2 extra spaces at the end...so when I do a condition check, it works for those tht have "NEW" btu doesnt if its "NEW "

    Is there some TRIM function to get rid of the 2 spaces when they appear...

    mysql="SELECT * FROM Test WHERE number='10'"
    Set rs= Con.Execute( mySQL )


    if rs("status")="NEW" then
    ...
    else
    ...
    end if

    A silly fix that I did is just put an or rs("status")="NEW " in it...any better ideas???

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,965
    Thanks
    0
    Thanked 236 Times in 233 Posts
    You already mentioned it.
    Code:
    if Trim(rs("status"))="NEW"  then

  • #3
    New Coder
    Join Date
    Jan 2007
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks works like a charm:

    So Trim(string) removes spaces on both sides of a string...good info

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,965
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Yeah, Trim(String) removes spaces on both sides of the string. LTrim(String) trims the left side and RTrim(String) the right side.

  • #5
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

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