I'm having trouble applying a currency format to a numeric value and could use some thoughts/ideas/help.
For our Swiss German locale, we want to display price values with a currency symbol of "SFr.". I figured I could using the CurrencyInstance of the DecimalFormatter for the job. Here's the details:
The format is: SFr.#,##0.00
The code snippet is:
DecimalFormat df = (DecimalFormat)NumberFormat.getCurrencyInstance(Locale.getDefault());
// df.applyLocalizedPattern(strFormat);
df.applyPattern(strFormat);
No difference between .applyPattern() and .applyLocalaizedPattern(), both give the following exception:
java.lang.IllegalArgumentException: Multiple decimal separators in
pattern "SFr.#,##0.00"
at java.text.DecimalFormat.applyPattern(Unknown Source)
at java.text.DecimalFormat.applyPattern(Unknown Source)
Anyone have any ideas how I can apply this valid currency format? Note that I really can't extract the "SFr." every time. The format string could be passed in by the user and could be embedded, and plus it seems that currency symbol processing for the locale should be taken care of by the Java Locale processing.
Note that I start my VM with the following:
-Duser.language=de -Duser.region=CH
Thanks!
For our Swiss German locale, we want to display price values with a currency symbol of "SFr.". I figured I could using the CurrencyInstance of the DecimalFormatter for the job. Here's the details:
The format is: SFr.#,##0.00
The code snippet is:
DecimalFormat df = (DecimalFormat)NumberFormat.getCurrencyInstance(Locale.getDefault());
// df.applyLocalizedPattern(strFormat);
df.applyPattern(strFormat);
No difference between .applyPattern() and .applyLocalaizedPattern(), both give the following exception:
java.lang.IllegalArgumentException: Multiple decimal separators in
pattern "SFr.#,##0.00"
at java.text.DecimalFormat.applyPattern(Unknown Source)
at java.text.DecimalFormat.applyPattern(Unknown Source)
Anyone have any ideas how I can apply this valid currency format? Note that I really can't extract the "SFr." every time. The format string could be passed in by the user and could be embedded, and plus it seems that currency symbol processing for the locale should be taken care of by the Java Locale processing.
Note that I start my VM with the following:
-Duser.language=de -Duser.region=CH
Thanks!