cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal seperator representation dependant on locale

Former Member
0 Kudos

Hi,

I created a simpletype of the type double with representation #,##0.00 . When i put values in there it shows up on the screen as 1,000,000.00 . I understood that dependant of the locale, the representation could be also 1.000.000,00 for dutch languages for example. I want to test this for my app.....i tried adding the locale parameter to the end of the url but it didnt change anything....Anyone has a sugestion how to check this?

Much appreciated,

regards,

Hugo

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Hendriks,

You can use <b>java.text.NumberFormat</b>. Pass logon user's java.util.Locale to NumberFormat getCurrency method. Just follow the belwo code.


NumberFormat formatter = NumberFormat.getCurrencyInstance(locale);
formatter.setMaximumFractionDigits(2); // I want only 2 decimals
System.out.println(formatter.format(12345679.65236));

Hope this solves.

Thanks,

Raags

Sigiswald
Contributor
0 Kudos

Hi Hugo,

If your application requires authentication, you can change the language of the user. Otherwise you can change the language of the browser (in IE7: Options / General / Languages). You could also change the default language of the portal, or as a last resort, of the JVM e.g. by calling <i>java.util.Locale.setDefault(Locale.GERMAN);</i>.

Kind regards,

Sigiswald