on 07-06-2011 8:32 AM
Hi,
I have developed a WebDynpro Application. Now I want to format a double value like this:
double zahl = 14532.45;
messageManager.reportSuccess("zahl: " + zahl);
DecimalFormat zf = new DecimalFormat ( ",##0.00 \u00A4" );
messageManager.reportSuccess("zahlf: " + zf.format(zahl));
For zahlf I get "14,532.45 $" but I want "14.532,45 u20AC". I think my Project is american and not german. But where can I change the language setting? Or is there another option to format it correctly?
Now I get the following error message:
CURRENCYSTYLE cannot be resolved
Is there a library missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use this example as a reference to your requirement
import java.text.*;
import java.util.*;
public class IntegerSample {
public static void main(String args[]) {
int amount = 54321;
NumberFormat usFormat =
NumberFormat.getIntegerInstance(Locale.US);
System.out.println(usFormat.format(amount));
NumberFormat germanFormat =
NumberFormat.getIntegerInstance(Locale.GERMANY);
System.out.println(germanFormat.format(amount));
}
}
Hope this helps you..
Regards,
Saleem Mohammad
you should supply locale info
public static NumberFormat getCurrencyInstance(Locale inLocale) {
return getInstance(inLocale, CURRENCYSTYLE);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.