Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
:)