AS3 Pad an Integer with Specified Number of Zeros


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function padZeros(num:int, digits:int=2):String
  2. {
  3. var s:String = String(num);
  4. while (s.length < digits) {s = "0" + s};
  5. return s;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.