Skip to content

Instantly share code, notes, and snippets.

@kulturpessimist
Created May 8, 2013 16:05
Show Gist options
  • Save kulturpessimist/5541504 to your computer and use it in GitHub Desktop.
Save kulturpessimist/5541504 to your computer and use it in GitHub Desktop.
String padding as prototype based on my.trading.io code.
String.prototype.pad = function(lenght, padding, left) {
var p = (new Array(lenght - this.toString().length + 1)).join(padding);
return ( left?p+this:this+p )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment