Profile
Achievement
adrianparr's Recent SnippetsTagged number
- All /
« Prev 1 Next »
Examples of different ways to truncate/round a decimal number.
0
2508
posted 15 years ago by adrianparr
Full credit for this goes to Deva Raj (@nsdevaraj). This is also a good function for doing a similar thing, http://snipplr.com/view/27954/as3-convert-a-number-to-a-string/
2
2818
posted 15 years ago by adrianparr
This returns a string with a single space after the fifth character.
Useful for displaying a UK mobile number which is easy to read.
0
2109
posted 16 years ago by adrianparr
If the item cannot be found then the return value is NaN. This function only returns the index of the first occurence found, so it's not very good if you have multiple occurrences of the same value in the array.
0
4025
posted 16 years ago by adrianparr
// Example usage ...
trace(fNumToWord(56345));
// Output ...
// Fifty-Six Thousand and Three Hundred and Forty-Five
0
2806
posted 16 years ago by adrianparr
Format a number so it is more humanly readable. It allows for setting the number of decimal places (inc. adding 0000s to the end) and separating thousands with a comma.
Example usage:
trace(numberFormat(1234.695, 2, true, false));
// Output:...
0
2881
posted 16 years ago by adrianparr