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

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;
RTrim()
String.prototype.RTrim = function() {
    return this.replace(/\s+$/g, "");
Rtrim()
String.prototype.Rtrim = function(){
  return this.replace(/(\s*$)/g, "");
};
endTrim(char)
String.prototype.endTrim = function (char) {
    let length = this.length;
    if (length) {
        if (this.charAt(length - 1) === char) {
            return this.substring(0, length - 1);
    return this.toString();
};
...