I have to write code that will format the value according to the specified options.
Right now there are several formatting options that can be selected: Number rounding / sorting, prefix (for example $) or postfix (such as%) with specified precision, thousands of groups (comma applied) Numeric abbreviations (KMB) have been added by adding.
For example, number 1857 can be displayed as $ 2 or $ 1.86 or $ 1,867
First of all, I have created this for Decorator Thoughts of using patterns, but I'm not sure because the formats should apply to them a specific order, like I need to implement the IMB conversion: 1857 -> 1.857 k, then it's 1.86. in between.
Do you have any suggestions?
Thanks, Matlee
No, use the java.text.NumberFormat option Which are available to you They have already fully internationalized.
Comments
Post a Comment