Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 478
  • Last Modified:

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!
0
Greengiants15
Asked:
Greengiants15
  • 2
  • 2
1 Solution
 
objectsCommented:
0
 
objectsCommented:
and you should be use getCurrencyInstance() to parse a currency value
0
 
CEHJCommented:
You're constructing your Locale wrongly. Should be
new Locale("pt", "BR")

Open in new window

0
 
CEHJCommented:
:)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now