Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes NumberFormat / currency Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "NumberFormat / currency" Watch "NumberFormat / currency" New topic
Author

NumberFormat / currency

mark reusen
Greenhorn

Joined: Oct 20, 2010
Posts: 22
I'd like to format the price in a Euro sign, I tried without an argument and also with argument Locale.GERMAN.
Result is no format.

When I use Locale.UK as an argument it works fine, then the Pound-sign appears...... also with the Locale.US (Dollar-sign appears)

NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.GERMAN);
return currency.format(price);


price is defined as a double by the way..
Mohamed Sanaulla
Bartender

Joined: Sep 08, 2007
Posts: 2928
    
  15

Locale.GERMAN is for language, you might want to try- Locale.GERMANY as it would represent the country and that way also the currency. By the way Locale.US/Locale.UK represents the country.


Mohamed Sanaulla | My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NumberFormat / currency
 
Similar Threads
Problem in setting locale
Problems in setting a locale
Help with currency symbol
Converting to Float
how to convert double as a currency