cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with language

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Now I get the following error message:

CURRENCYSTYLE cannot be resolved

Is there a library missing?

junwu
Active Contributor
0 Kudos

it's pure java, nothing to do with sap. you can google and will find a lot of solution.

what's your jdk version?

Former Member
0 Kudos

My JDK is: j2sdk1.4.2_17

junwu
Active Contributor
0 Kudos

the method i show you in previous post is a standard method of NumberFormat

Former Member
0 Kudos

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

Former Member
0 Kudos

Thank you for your hints. I solved it like this way:

double zahl = 14532.45;
Locale deLoc = new Locale("de", "DE");
NumberFormat numForm = NumberFormat.getCurrencyInstance(deLoc);
numForm.format(zahl));

junwu
Active Contributor
0 Kudos

you should supply locale info

public static NumberFormat getCurrencyInstance(Locale inLocale) {
        return getInstance(inLocale, CURRENCYSTYLE);
    }