Java tutorial
//package com.java2s; //License from project: Open Source License import android.text.TextUtils; import java.text.DecimalFormat; public class Main { public static String formatMoneyYuan(String amount) { if (TextUtils.isEmpty(amount)) { return "0.00"; } String result; try { double num = Double.parseDouble(amount); DecimalFormat formater = new DecimalFormat("###,##0.00"); result = formater.format(num); } catch (NumberFormatException e) { result = amount; } return result; } }