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 )
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 )