tags:

views:

687

answers:

1

How can I get users local decimal separator character from GWT. I have found the NumberFormat utility, which only returns the whole format and provides parsing.

NumberFormat.getDecimalFormat()...

Is there a (simple) way to get the decimal separator, thousand separator from the decimal format.

+1  A: 

You can seed it with a known number and then parse it for the characters you want.

import com.google.gwt.i18n.client.NumberFormat;

NumberFormat fmt = NumberFormat.getDecimalFormat();
double value = 1234.5;
String formatted = fmt.format(value);
String thousandSeparator = formatted.substring(1,2);
String decimalSeparator = formatted.substring(5,6);
Bill
This was also my idea, but I thought there is a more elegant way to do it. Will mark this as the correct answer as in 2 days this is the only one.
Drejc