|
-
Software Developer
[F8] Format()
Is there some kind of Format(Object, "format string") method in flash?
What I am trying to accomplish is the following;
Code:
Var nNumber : Number = 1234567890;
Var nNumber2 : Number = 7;
trace (format(nNumber, "#,###,###,###,##0"));
trace (format(nNumber2, "#,###,###,###,##0"));
output should be:
Anyone know of a way to do this or will i have to write my own function?
Post you game for free at Gamestack.org. We send the user straight to your website, no iFrames or other leeching methods.
Please check out Gamestack.org for more information.
-
FK'n_dog
will i have to write my own function?
no need to re-invent the wheel -
Currency Formatting
This sample includes a function that receives parameters for value,
number of decimal places, and the character to use as a separator
in the great-than-zero part of the number, for instance, commas in
“1,000,000.00”. If no separator character is specified (comma is default),
none will be used. If no places are specified, or places is specifed as zero,
the number will be a rounded integer. This example uses input textfields
for allowing the user to specify the values, but the function has also been
built to accept actual numeric values, and includes error trapping.
Function includes verbose commenting.
http://canfieldstudios.com/flash5/currfrmt/index.html
-
Software Developer
Thanks dog thats exactly what I was looking for.
Just needed to change it to a function and worked perfectly.
Post you game for free at Gamestack.org. We send the user straight to your website, no iFrames or other leeching methods.
Please check out Gamestack.org for more information.
-
FK'n_dog
you're welcome
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
|