RE: please help

Subject: RE: please help
From: "Brian Mulder" <mulbum@xxxxxxxxxxxxxx>
Date: Tue, 30 May 2000 21:25:58 +0200
indeed off topic but

The following will return "off-topic post".

trim("    off-topic post     ")

function ltrim(argvalue) {

  while (1) {
    if (argvalue.substring(0, 1) != " ")
      break;
    argvalue = argvalue.substring(1, argvalue.length);
  }

  return argvalue;
}

function rtrim(argvalue) {

  while (1) {
    if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
      break;
    argvalue = argvalue.substring(0, argvalue.length - 1);
  }

  return argvalue;
}

function trim(argvalue) 
{
  var tmpstr = ltrim(argvalue);

  return rtrim(tmpstr);
}

of course you can combine them in one function.....

Good Luck 
BrianM


<quote>
I think this question is out of the list but if anyone could help
i need a javascript function which removes trailing spaces from a string.
one more thing if any one of u is aware of a javascripts mailing list
thanks in advance
abdul
</quote>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread