因为项目需要,写了一个common的对数值处理的method,虽然很简单,记下来吧

 

public static String convertDecimal(String value){

if(!StringUtils.isEmptyString(value)){ //jdk1.4版本,现在的可用Stringutil.isNotEmpty() 替代

DecimalFormat fm1=new DecimalFormat("###,##0.00");//保留两位小数,如果为0,显示0.00

return fm1.format(Double.parseDouble(value));

}else{

return null;

}
}

 

posted on 2015-07-22 13:42  jianlunx  阅读(132)  评论(0编辑  收藏  举报