-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: NumberFormatter - Thousand seperator and decimals #58
Comments
Updated by mikechambers on 2008-07-03T16:30:28 Anyone interested in contributing this? Removed label Type-Defect |
Updated by trimediapro on 2008-07-05T15:03:26 I sent you an email Mike. |
Updated by trimediapro on 2008-07-07T01:52:11 Here's what I put together. I have add in 3 static functions to NumberFormatter Here are some examples and a basic explanation of all 3. The "addSeparator" function is for adding a "thousands separator" into a number. The "formatDecimal" function is for doing just that. The "format" function of the NumberFormatter is much more versatile. You can get the NumberFormatter.format(p_num:Number, p_separator:String, p_decimalPlaces:Number=0, // Sample Calls If just the thousands separator needs to be added If just the decimal needs to change If the decimal needs to change and the number is rounded to n decimal places If the thousands separator needs to be added and the decimal needs to change If the thousands separator needs to be added and the decimal needs to change and the All of the functions should work with positive and negative numbers. I'm fairly certain that parts of the format function could be optimized. I was just I have attached the updated NumberFormatter.as file for submission into corelib. ...Neil Madsen |
Updated by trimediapro on 2008-07-08T05:37:40 I found a bug in the previous file when rounding a number smaller than 0.1 Here's the newer version of the NumberFormatter.as file. ...Neil |
Updated by mikechambers on 2008-07-08T15:57:04 I put together a test case to check some edge cases for the addSeperator API, and the
|
Updated by trimediapro on 2008-07-09T03:28:52 Hi Mike... ...Neil |
Originally filed by madsbsstage on 2008-07-03T09:17:45
addThousandSeperator(123456789, true) would return 123.456.789
addThousandSeperator(123456789, false) would return 123,456,789
formatDecimals(123.456789, 2, true) would return 123,46
formatDecimals(123.456789, 2, false) would return 123.46
The text was updated successfully, but these errors were encountered: