shake Posted September 22, 2004 Share Posted September 22, 2004 i have a variable that can have a varied length ... i want to pad it with zeros so that the length remains 10, any ideas how to do that directly without using any loops e.g 12345 becomes 0000012345 etc tx Link to comment Share on other sites More sharing options...
0 em_te Posted September 22, 2004 Share Posted September 22, 2004 var n = 12345; var s = "0000000000" + n; s = s.substring(s.length - 10, s.length); Link to comment Share on other sites More sharing options...
0 shake Posted September 22, 2004 Author Share Posted September 22, 2004 thanx will try that right now Link to comment Share on other sites More sharing options...
Question
shake
i have a variable that can have a varied length ... i want to pad it with zeros so that the length remains 10, any ideas how to do that directly without using any loops
e.g 12345 becomes 0000012345 etc
tx
Link to comment
Share on other sites
2 answers to this question
Recommended Posts