Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function delimit(num:Number):String {
- var string:String = num.toString();
- var newString:String = '';
- var first:int = string.length - Math.floor(string.length / 3) * 3;
- if (first > 0) newString = string.substr(0, first) + ',';
- for (var a:int = first; a < string.length; a += 3) {
- newString += string.substr(a, 3) + ',';
- }
- newString = newString.substr(0, newString.length - 1);
- return newString;
- }
Add Comment
Please, Sign In to add comment