Return to Snippet

Revision: 7689
at August 6, 2008 14:08 by FlashJunior


Updated Code
public function setThousands(value:String):String
{
	var pattern:RegExp = /(\d+)(\d{3}(\.|,|$))/gi;
	var str:String = value;
	
	while (str.match(pattern).length != 0)
	{
		str = (str.replace(pattern, "$1.$2"));	
	}
	
	return str;
}

Revision: 7688
at August 6, 2008 14:07 by FlashJunior


Initial Code
public function thousands(value:String):String
{
	var pattern:RegExp = /(\d+)(\d{3}(\.|,|$))/gi;
	var str:String = value;
	
	while (str.match(pattern).length != 0)
	{
		str = (str.replace(pattern, "$1.$2"));	
	}
	
	return str;
}

Initial URL

                                

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

Initial Title
Turn 10000000 into 10.000.000

Initial Tags
number

Initial Language
ActionScript 3