...

View Full Version : TRIM function?



terp_in_umcp
04-09-2007, 11:03 PM
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???

glenngv
04-10-2007, 07:09 AM
You already mentioned it.

if Trim(rs("status"))="NEW" then

terp_in_umcp
04-10-2007, 04:55 PM
Thanks works like a charm:

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

glenngv
04-10-2007, 10:05 PM
Yeah, Trim(String) removes spaces on both sides of the string. LTrim(String) trims the left side and RTrim(String) the right side.

degsy
04-18-2007, 03:24 PM
Just for reference
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum