Nodejs Utililty Methods String Padding Right

List of utility methods to do String Padding Right

Description

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

Method

rpad(character, count)
String.prototype.rpad = function(character, count) {
  var ch = character || "0";
  var cnt = count || 2;
  var s = "";
  while (s.length < (cnt - this.length)) { s += ch; }
  s = s.substring(0, cnt-this.length);
  return this+s;
rpad(count, pad)
String.prototype.rpad = function(count, pad) {
    pad = pad || '0';
    str = this + '';
    return str.length >= count ? str : str + new Array(count - str.length + 1).join(pad);
};
rpad(padString, length)
'use strict';
String.prototype.rpad = function(padString, length) {
  var str = this;
  while (str.length < length) {
    str = str + padString;
  return str;
};
rpad(padString, length)
String.prototype.rpad = function(padString, length) {
  var str = this;
  while(str.length < length)
    str = str + padString;
  return str;
rpad(padString, length)
String.prototype.rpad = function(padString, length) {
  var str = this;
    while (str.length < length){
        str = str + padString;
    return str;
rpad(padString, length)
String.prototype.rpad = function(padString, length) {
  var str = this;
    while (str.length < length)
        str = str + padString;
    return str;
};
rpad(padString, length)
String.prototype.rpad = function(padString, length) {
  var str = this;
    while (str.length < length)
        str = str + padString;
    return str;
rpad(pad_str, length)
String.prototype.rpad = function(pad_str, length) {
  var str = this;
  while (str.length < length) str = str + pad_str;
  return str;