Locale problems

I have a locale problem. An example is 3.44 in Engliah decimals is 3.44 but in italian is 344. The below piece of code shows the code for doing that. I want to be able to say that 3.44 should be treated as 3.44 and not 344 in italian. I am writing a program which have language features so you are able to switch between languages. If you have formulas the format issue is a problem.

NumberFormat guiseppe = NumberFormat.getInstance(Locale.ITALY);

NumberFormat joe = NumberFormat.getInstance(); // defaults to Locale.US

try {

double theValue = guiseppe.parse("34.663,252").doubleValue();

System.out.println(joe.format(theValue)); // 34,663.252

}

catch (ParseException e) {}

Love to hear your opinion Java programmers.

Message was edited by:

iu433

[816 byte] By [iu433a] at [2007-11-27 5:08:42]
# 1

> I have a locale problem. An example is 3.44 in

> Engliah decimals is 3.44 but in italian is 344.

I don't believe that.

You have to demark the fractional part of the value in some form.

For example given 3444 how do you know it isn't 34.44 or 3.444?

Maybe there was a posting glitch?

> I am writing a program

> which have language features so you are able to

> switch between languages.

The user picks the locale. You then use it in all display and parsing algorithms. They pick another one and then they use that.

Why would a single client app need to switch?

jschella at 2007-7-12 10:28:14 > top of Java-index,Java Essentials,Java Programming...