Nodejs String Trimming Right rightTrim()

Here you can find the source of rightTrim()

Method Source Code

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

Related

  1. trimRight()
    String.prototype.trimRight = String.prototype.trimRight || function () {
        return this.replace(/\s+$/g, "");
    };
    String.prototype.trimLeft = String.prototype.trimLeft || function () {
        return this.replace(/^\s+/g, "");
    };
    String.prototype.endsWith = String.prototype.endsWith || function(suffix) {
        return this.length ? this.lastIndexOf(suffix) === this.length - 1 : false;
    };
    ...
    
  2. trimRight(character)
    String.prototype.trimRight = function (character) {
      character = character || ' ';
      return this.replace(new RegExp('[' + character + ']+$'), "");
    };
    
  3. trimRight(charlist)
    String.prototype.trimRight = function(charlist) {
        "use strict";
        if (charlist === undefined)
            charlist = "\s";
        return this.replace(new RegExp("[" + charlist + "]+$"), "");
    };
    
  4. trimRighttrimRight()
    if (!String.prototype.trimRight)
    String.prototype.trimRight = function trimRight() {
      return this.replace(/(?:\s|\u00A0)+$/, '');
    };
    
  5. rightTrim()
    String.prototype.rightTrim = function () {
        return this.replace(/\s+$/, "");
    
  6. TrimEnd( aimStr )
    String.prototype.TrimEnd = function( aimStr )
        var str = this;
        var re = My.RegExp.InvolvedCharsRegExp;
        var reEnd;
        if ( aimStr )
            aimStr = aimStr.replace( re, '\\$1' );
            reEnd = new RegExp( '(' + aimStr + ')+$' );
    ...
    
  7. TrimEnd(v)
    String.prototype.TrimEnd = function (v)
        if (this.substring(this.length - 1, this.length) == v) {
            return this.substring(0, this.length - 1);
        else {
            return this;
    
  8. RTrim()
    String.prototype.RTrim = function() {
        return this.replace(/\s+$/g, "");
    
  9. Rtrim()
    String.prototype.Rtrim = function(){
      return this.replace(/(\s*$)/g, "");
    };