For the code:
DecimalFormat df = (DecimalFormat) NumberFormat.getNumberInstance(locale);
df.applyPattern("#.##0,00");
And it throws an IllegalArgumentException with a message of Malformed pattern "#.##0,00"
What is wrong with this?
Edit: I want to use the . as a thousands separator and , as the decimal. I know that's ass-backwards but have a case where that's the format they want.
You need to use the pattern "#,##0.##" to indicate where you want to decimal separator and the thousand seperator. The Locale
you use when using this DecimalFormat
will then determine if the decimal separator is a .
or ,
-- the pattern should NOT be changed.
If you are not getting the correct separators, you will need to use a different Locale
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With