Javascript String rpad(pad_str, length)

Description

Javascript String rpad(pad_str, length)

// Pads strings to the right.
String.prototype.rpad = function(pad_str, length) {
  var str = this;
  while (str.length < length) str = str + pad_str;
  return str;/*w  w  w  . j av a  2  s  .c o  m*/
}



PreviousNext

Related