Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java and Currency Counting (Brazil)

Posted on 2011-03-09
4
Medium Priority
?
472 Views
Last Modified: 2012-05-11
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
Comment
Question by:Greengiants15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 35090616
0
 
LVL 92

Expert Comment

by:objects
ID: 35090630
and you should be use getCurrencyInstance() to parse a currency value
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 35093013
You're constructing your Locale wrongly. Should be
new Locale("pt", "BR")

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35095023
:)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question