Javascript String padLeft(n, ch)
String.prototype.padLeft = function(n, ch){ var s = this; while(s.length < n){ s = ch + s;//w w w . j a va2s . co m } return s; }