Javascript String rtrim()

Description

Javascript String rtrim()


String.prototype.rtrim = function() {
    return this.replace(/\s+$/,"");
};

Javascript String RTrim()

String.prototype.RTrim = function() { 
 return this.replace(/(\s*$)/g,""); 
}

Javascript String rtrim()

// trim whitespaces right
String.prototype.rtrim = function() {
  return this.replace(/\s*$/g,'');
}

Javascript String rtrim()

String.prototype.rtrim=function()
{
  return this.replace(/(\s*$)/g,'');
}

Javascript String rtrim()

String.prototype.rtrim = function() {
    return this.replace(/\s+$/, '');
};

Javascript String rTrim()

String.prototype.rTrim = function(){
 str = this;/*from  w  ww .  ja  v  a  2  s  .c  om*/
 var i;
    for(i=str.length-1;i>=0;i--)
    {
        if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
    }
    str=str.substring(0,i+1);
    return str;
}

Javascript String rtrim()

String.prototype.rtrim = String.prototype.rtrim || function () {
    return this.replace(/\s+$/, "");
};



PreviousNext

Related