Return to Snippet

Revision: 1599
at October 26, 2006 07:55 by garamond


Updated Code
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;
	}
}

Revision: 1598
at October 26, 2006 01:10 by garamond


Initial Code
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 num;
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
addComma function using recursion

Initial Tags
number

Initial Language
ActionScript