GWTからユーザーにローカル小数点記号を取得するにはどうすればよいですか。フォーマット全体を返し、解析を提供するNumberFormatユーティリティを見つけました。
NumberFormat.getDecimalFormat()...
10進形式から小数点記号、千単位の区切り文字を取得する(簡単な)方法はありますか?
GWTからユーザーにローカル小数点記号を取得するにはどうすればよいですか。フォーマット全体を返し、解析を提供するNumberFormatユーティリティを見つけました。
NumberFormat.getDecimalFormat()...
10進形式から小数点記号、千単位の区切り文字を取得する(簡単な)方法はありますか?
import com.google.gwt.i18n.client.LocaleInfo;
String decimalSeparator = LocaleInfo.getCurrentLocale().getNumberConstants().decimalSeparator();
String thousandSeparator = LocaleInfo.getCurrentLocale().getNumberConstants().groupingSeparator();
既知の数値でシードしてから、必要な文字を解析できます。
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);