Decimal format template

I would like to translate 10000000.0intoPREFIX10,000,000.00

Can I find out which template I should pass to DecimalFormat?

NumberFormat numberFormat = new DecimalFormat(...);
numberFormat.format(10000000.0);
+3
source share
2 answers
new DecimalFormat("PREFIX#,##0.00");

This will always show at least one integer digit (e.g. 0) and use a comma as a group separator.

+6
source

The pattern for the number will be:, "#,###.00"which means:

  • use language-based grouping delimiter
  • use language based decimal separator
  • always has 2 places after the decimal separator
  • have as many digits as needed

arbirary. , . . DecimalFormat JavaDoc

+2

Source: https://habr.com/ru/post/1760909/


All Articles