That is similar to what the UnitFmt class does with the autoScale flag turned on, but I think you are talking about plain numbers with no units, right? If so, then ilib does not do that yet.
What is it you're counting? Ilib currently handles autoscaling for these types of measures:
Area
Digital Storage (as in bytes, megabytes, etc.)
Energy
Fuel Consumption
Length
Mass
Temperature
Time
Velocity
Volume
Others can be added easily if you let us know what you are counting.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah I have had a look at the UnitFmt class but not quite got the result i wanted. As you said this is just plain numbers that I would like to have in compact form, like;
I think there should probably be an "autoScale" option for the number formatter (NumFmt) to handle this. That would get plain unit-less numbers, as well as currency and percentages as well.
I'm looking in CLDR 28, and I see the right data for that sort of thing in the numbers.json for many locales. Here's the one for English as an example:
Oh, and the autoscale option for the UnitFmt class is on by default, so if you've already looked at UnitFmt, then it probably won't work for your needs as-is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okey, thanks for the information. It would be nice to have that type of functionality added to the NumFmt. But I understand that you have alot on your plate :]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Is there any way to format numbers like "1000000" to be "1M" using iLib?
That is similar to what the UnitFmt class does with the autoScale flag turned on, but I think you are talking about plain numbers with no units, right? If so, then ilib does not do that yet.
What is it you're counting? Ilib currently handles autoscaling for these types of measures:
Others can be added easily if you let us know what you are counting.
Yeah I have had a look at the UnitFmt class but not quite got the result i wanted. As you said this is just plain numbers that I would like to have in compact form, like;
en-US 1000 =>"1K", 10.000 => "10K", 100.000 => "100K"
or could also be with currency
$1000000 -> $1M
But I have not tried with the autoScale flag on, maybe I should give that a shot.
I think there should probably be an "autoScale" option for the number formatter (NumFmt) to handle this. That would get plain unit-less numbers, as well as currency and percentages as well.
I'm looking in CLDR 28, and I see the right data for that sort of thing in the numbers.json for many locales. Here's the one for English as an example:
A quick scan of other common locales shows that the data is reasonably translated for all of them. So, this should be quite do-able.
I'll add it to the backlog. I won't be able to get to it soon, though. (Anyone want to contribute?)
Last edit: Edwin H 2016-02-04
Oh, and the autoscale option for the UnitFmt class is on by default, so if you've already looked at UnitFmt, then it probably won't work for your needs as-is.
Okey, thanks for the information. It would be nice to have that type of functionality added to the NumFmt. But I understand that you have alot on your plate :]