Skip to content

Instantly share code, notes, and snippets.

@mchambaud
Created September 23, 2013 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchambaud/6673772 to your computer and use it in GitHub Desktop.
Save mchambaud/6673772 to your computer and use it in GitHub Desktop.
if (!String.prototype.padRight) {
String.prototype.padRight = function (length, str) {
str = str || ' ';
return this.length >= length
? this
: this + (new Array(Math.ceil((length - this.length) / str.length) + 1).join(str)).substr(0, (length - this.length));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment