formatting issues displaying currency other than locale's default

A

Adam Monsen

( crossposted here: http://www.javajunkies.org/index.pl?node_id=5049 )

I'm in the en_US locale, and I want to display some amount of Euros.
Is there some industry standard for where to place the Euro symbol,
what thousands separator, and what decimal point character to use? And
if so, is there something built in to Java 1.5 or greater (or in a 3rd
party library) to produce this formatting for me?

Using java.text.NumberFormat, I can format the monetary value 1234.56
in Euros as follows:

import java.text.NumberFormat;
import java.util.Locale;

class NFmt {
public static void main(String args[]) {
NumberFormat nf =
NumberFormat.getCurrencyInstance(Locale.FRANCE);+

String fmttt = nf.format(1234.56);
System.out.println(fmttt);
}
}

This prints 1 234,56 EURO. But someone in the USA expects money to have a
comma for the thousands separator, a period for the decimal point, and
the currency symbol on the left, even if they're looking at some
amount of Euros. Right?

This related thread comes close, but doesn't land on the solution as
far as I can tell:
http://groups.google.com/group/comp...read/thread/a3a32d6210a0076d/862223929125627a
(same URL, shortened: http://tinyurl.com/3bhf5q )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top