Turn 10000000 into 10.000.000


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

what more can i say?! Just a small Regular expression...


Copy this code and paste it in your HTML
  1. public function setThousands(value:String):String
  2. {
  3. var pattern:RegExp = /(\d+)(\d{3}(\.|,|$))/gi;
  4. var str:String = value;
  5.  
  6. while (str.match(pattern).length != 0)
  7. {
  8. str = (str.replace(pattern, "$1.$2"));
  9. }
  10.  
  11. return str;
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.