Here are some working functions, Really, just one:
/************************************************************
trims both trailing and leading spaces, and returns string
*/
function trim(sString:String):String
{
return(lTrim(rTrim(sString)));
}//trim
/************************************************************
trims trailing spaces, and returns string
*/
function rTrim(sString:String):String
{
while(''+sString.charAt(sString.length-1)==' ')
{
sString=sString.substring(0,sString.length-1);
}
return(sString);
}//rTrim
/************************************************************
trims leading spaces, and returns string
*/
function lTrim(sString:String):String
{
while(''+sString.charAt(0)==' ')
{
sString=sString.substring(1,sString.length);
}
return(sString)
}//lTrim
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Rajesh Jayabalan
Sent: Wednesday, May 18, 2005 3:08 PM
To: [email protected]
Subject: [flexcoders] string trim
Hi,
How do I trim a string in the actionscript?
when I do this
if( combo.dataProvider[i].data == item[ getDataLabel() ] )
sometimes
item[ getDataLabel() ] returns a string with extra spaces and it
fails the condition
Regards
Rajesh J
Yahoo! Groups Links
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/