Nodejs Utililty Methods String Trimming Right

List of utility methods to do String Trimming Right

Description

The list of methods to do String Trimming Right are organized into topic(s).

Method

rtrim()
String.prototype.rtrim = function() {
  return this.replace(/(\s*$)/g, "");
rtrim()
String.prototype.rtrim = function() {
  return this.replace(/\s+$/,'');
rtrim()
String.prototype.rtrim = function()
  return this.replace( /\s*$/g, '' ) ;
rtrim()
String.prototype.rtrim = function(){
    var res = this;
    while (res.substring(res.length - 1, res.length) == " ") {
        res = res.substring(0, res.length - 1);
    return res;
rtrim()
String.prototype.rtrim=function()
  {return this.replace(/\s+$/,'');}
rtrim(ch)
String.prototype.rtrim = function(ch) {
    var r = new RegExp("{0}+$".format(ch || "\\s"))
    return this.replace(r, "");
};
rtrim(charlist)
String.prototype.rtrim = function (charlist) {
  charlist = !charlist ? ' \\s\u00A0' : (charlist + '').replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');
  var re = new RegExp('^[' + charlist + ']+', 'g');
  return this.replace(re, '');
};
trimEnd()
String.prototype.trimEnd = function() {
  for (var i=this.length-1; this.charAt(i) ==' '; i--) {
    this.substring(0, i);
  return this;
};
trimEnd(c)
String.prototype.trimEnd=function(c)
    c = c?c:' ';
    var i=this.length-1;
    for(;i>=0 && this.charAt(i)==c;i--);
    return this.substring(0,i+1);
var Utils = {
    getValues : function(dataSet)
...
trimEnd(c)
String.prototype.trimEnd=function(c)
    c = c?c:' ';
    var i=this.length-1;
    for(;i>=0 && this.charAt(i)==c;i--);
    return this.substring(0,i+1);