Link to home
Create AccountLog in
Avatar of Greengiants15
Greengiants15

asked on

Java and Currency Counting (Brazil)

Hi Experts,

I'm trying to format currency in Brazil but Java simply does not know how to handle this.

ex:
NumberFormat format = NumberFormat.getInstance(new Locale("br"));
Object value = format.parse("5,45");

value ends up translating to 54500.  It's very strange.  Does anyone know why and how I can properly format the value?

Thanks!
Avatar of Mick Barry
Mick Barry
Flag of Australia image

and you should be use getCurrencyInstance() to parse a currency value
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
:)