This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Number Format problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Number Format problem" Watch "Number Format problem" New topic
Author

Number Format problem

Yaddif Medina
Greenhorn

Joined: Oct 05, 2005
Posts: 23
Hi all,

I have a problem with my web application in Linux (White Box 4). The DecimalFormat that I am using does not take into account the "regional setting". The linux have the numeric format as : "12,123,123.45" (which I wanted), but when I executed the following sentence it returns "12.123.123,45" !!!.

java.text.NumberFormat df=java.text.DecimalFormat.getCurrencyInstance(java.util.Locale.US);

How can I force to the right format? it is not supposed to be taken from the operating system?.

PS. If I run my application in a windows server it works fine.

Thanks in advance.

Yaddif
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
I'm not sure why you're getting the results you're getting. You could try specifically setting the DecimalFormatSymbols to the US Locale.

[ March 18, 2006: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Yaddif Medina
Greenhorn

Joined: Oct 05, 2005
Posts: 23
The problem is that I am running Jasper Report for my application and it is not formating the number as the "regional setting" ... are there some "global" java parameter to do this?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Number Format problem