Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Java and Currency Counting (Brazil)

Posted on 2011-03-09
4
Medium Priority
?
476 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
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

926 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