以区域设置感知方式设置数字格式的推荐方法?
假设我们有一百万。
在英语中,它应该被格式化,因为在德语中它应该是。1,000,000
1.000.000
假设我们有一百万。
在英语中,它应该被格式化,因为在德语中它应该是。1,000,000
1.000.000
使用数字格式类:
对于英语:
NumberFormat nf_us = NumberFormat.getInstance(Locale.US);
String number_us = nf_us.format(1000000);
对于德语:
NumberFormat nf_ge = NumberFormat.getInstance(Locale.GERMAN);
String number_ge = nf_ge.format(1000000);