Skip to content

Instantly share code, notes, and snippets.

@L-four
Created March 26, 2013 01:30
Show Gist options
  • Save L-four/5242398 to your computer and use it in GitHub Desktop.
Save L-four/5242398 to your computer and use it in GitHub Desktop.
var str_pad = function(str, len, pad, left) {
var tmp = [str];
tmp[left?"unshift":"push"](new Array(len).join(pad||"0"));
return tmp.join('');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment