/ Published in: ActionScript 3
Format number using a comma as a separator
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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 }
URL: http://klr20mg.com