We need this method:

The input is a double number and a string containing the formatting rules; These rules conform (not necessarily strictly) to this standard: Custom Numeric Format Strings .

The output is a string containing a number formatted according to these rules.

Is there any Java library that does this?

PS:

Ultimately, it will run on the BlackBerry . Unfortunately, the Java API is very truncated there, there is no such standard standard library for formatting.

  • Is this small-time format of numbers required or is it just necessary to format the numbers using a custom pattern? String.format on Blackberry no? - cy6erGn0m
  • write something of your own. if the String.format method, * Formatter classes are cut out, you can take their source code, wrap a screwdriver that would parse the input format and result in their format - jmu
  • Not necessarily full compliance with the small format. Just formatting of numbers on the user template is required. At first, I wanted to take the java.text.DecimalFormat class from the sources of the standard Java API, but as a result I would have to pull dozens of other classes. This is still tolerable, but besides this, the source code for one of the classes from the sun packages is also not found. - dmitry_iii

1 answer 1

On SO, Comrade ported DecimalFormat to J2ME and uploaded to Google Code .