Pad strings on the right - Node.js String

Node.js examples for String:Padding

Description

Pad strings on the right

Demo Code

String.prototype.rpad = function(padString, length) {
  var str = this;
    while (str.length < length)
        str = str + padString;//from w  w  w. ja va 2 s .com
    return str;
}

Related Tutorials