I do it like this....  However, I know billy has a really good RegEx that
works better.

function trimString(sString){
   if (sString.charAt(0)==" ")
        {sString=sString.substring(1,sString.length);return
trimString(sString);}
   else if (sString.charAt(sString.length-1)==" ")
      {sString=sString.substring(0,sString.length-1);return
trimString(sString);}
   else
        return sString;
}

Robert

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 3:10 PM
To: [EMAIL PROTECTED]
Subject: How to trim a string inJscript?


Hi,

I want the values in my string variables trimmed from both sides. How to do
it not using loops through the string?

Henry Dilsky
Federal Reserve Bank of Dallas
tel.: (214)922-6721



-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to