前语言环境对数字进行本地化处理

/**
* 根据当前语言环境对数字进行本地化处理,如:es下的数字3.5应该为3,5
*/
public static String numFormatByLanguage(double d) {
NumberFormat nf = NumberFormat.getInstance();
// 若不需要分组符号,setGroupingUsed设置为false,默认为true
nf.setGroupingUsed(false);
String result = nf.format(d);
return result;
}

posted @ 2013-10-28 11:35  马骝  阅读(171)  评论(0编辑  收藏  举报