This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: please help


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]