Posted By

FlashJunior on 08/06/08


Tagged

number as3


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

THEPWN3R
quan


Turn 10000000 into 10.000.000


 / Published in: ActionScript 3
 

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

  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  

You need to login to post a comment.