function addComma(num:Number):String {
var tmp = num.toString();
if(tmp.length > 3) {
return arguments.callee(tmp.substring(0, tmp.length - 3)) +
"," +
tmp.substring(tmp.length - 3, tmp.length);
} else {
return tmp;
}
}
addComma function using recursion
Category: Uncategorized |
Tags: number
Leave a Reply
You must be logged in to post a comment.