Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

strpad jquery

function pad (str, max) {
  str = str.toString();
  return str.length < max ? pad("0" + str, max) : str;
}

pad("3", 3);    // => "003"
pad("123", 5);  // => "00123"
pad("1234", 2); // => "1234"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #strpad #jquery
ADD COMMENT
Topic
Name
8+4 =