Javascript String leftPad(character, totalLength)
/**/*from w w w . j a v a 2 s. c o m*/ * Padding character to string until it reaches given length */ String.prototype.leftPad = function (character, totalLength) { var s = this; while (s.length < totalLength) s = character + s; return s; }