Site icon Automation Dojos

Format Decimal Numbers Using Format Symbols

You can customize which symbols are used as decimal separator, grouping separator, currency seperator etc. using a DecimalFormatSymbols instance together with java.text.DecimalFormat class.

The DecimalFormatSymbols instance can be passed to java.text.DecimalFormat constructor followed by the call to format() method of java.text.DecimalFormat to achieve the desired decimal separator, grouping separator character etc.

The following example demonstrates formatting using DecimalFormatSymbols:

The above code produces the following output:

$170:180-246
Exit mobile version