public String toCommifyString(String sourceNum){
if(sourceNum.isEmpty())return "0";
if(sourceNum.length() <= 3) return sourceNum;
double num = Double.parseDouble(sourceNum);
DecimalFormat df = new DecimalFormat("#,###");
return df.format(num).toString();
}
No comments:
Post a Comment