Return to Snippet

Revision: 30478
at August 14, 2010 11:37 by Tmeister


Initial Code
function formatNumber(number:Number):String
{
        var nString:String = String(number)
        var rst:String = ''
        while (nString.length > 3)
        {
                var pcs:String = nString.substr(-3)
                nString = nString.substr(0, nString.length - 3)
                rst = ',' + pcs + rst
        }
        return (nString.length) ? rst = nString + rst : rst 
}

Initial URL
http://klr20mg.com

Initial Description
Format number using a comma as a separator

Initial Title
Formating numbers comma separator

Initial Tags
number, format

Initial Language
ActionScript 3