-
Dynamic Systems, Inc.
Convert integers to “US numeric format”?
Dear Falshkitters,
Will somebody be able to help me to find a script that allows to convert integers to “US numeric format”? That is, it converts 1000000 to 1.000.000, it converts 1200 to 1.200, etc.
Thank you very much in advance for your help.
Vahagn
► Dynamic Systems
► Professional Web Development Solutions!
► www.DySyst.com
-
Senior Member
Hi,
add the following to a frame at the start of your movie
code:
Number.prototype.format = function() {
var str = this.toString();
var lp = (str.length % 3 != 0) ? str.length % 3 : 3;
var formatStr = str.substr(0, lp);
for (var i = lp; i < str.length; i += 3) {
formatStr += "," + str.substr(i, 3);
}
return formatStr;
};
now in your movie you can use something like this,
var myNum = 7363275;
var myFormatedNum = myNum.format()
trace(myFormatedNum); // displays 7,363,275
Last edited by catbert303; 10-28-2003 at 12:23 PM.
-
Dynamic Systems, Inc.
Dear catbert303,
Thank you very much for your message and your help. Yes, that code was exactly what I needed. it works.
Thank you!
:-)
Vahagn
► Dynamic Systems
► Professional Web Development Solutions!
► www.DySyst.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|