Add Commas to Number


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



Copy this code and paste it in your HTML
  1. var scoreString:String = String(score);
  2. var regex:RegExp = /(\d)(?=(\d\d\d)+$)/;
  3. scoreString = scoreString.replace(regex, "$1,");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.