List of utility methods to do Money
float | moneyMinus(float a, float b) money Minus final int intA = (int) (100 * a); final int intB = (int) (100 * b); final int intResult = intA - intB; final float result = intResult / 100.0f; return result; |
Integer | multiMoney(Integer money) multi Money if (money == null) return 0; else { return money * rate; |
String | string2Money(String money) string Money if (money.matches("[0-9]{12,}")) { money = money.substring(0, money.length() - 2) + "." + money.substring(money.length() - 2); return money.replaceAll("^0+(?!$)", ""); } else { return null; |
String | translateMoneyStr(String money) translate Money Str if (money == null || money.length() == 0) { return money; StringBuffer sb = new StringBuffer(); int len = money.length(); int count = len / 3; int del = len % 3; sb.append(money.substring(0, del)); ... |