List of utility methods to do Money
String | _getStrMoney(Object money) get Str Money String strMoney = "0"; if (money != null) { strMoney = money.toString(); if (strMoney.equals("")) strMoney = "0"; return strMoney; |
long | doubleToMoney(double value) double To Money if (value < 0) return (long) (value * 10000 - 0.5); return (long) (value * 10000 + 0.5); |
float | fMoney(float pfNum) f Money float lfNum; if (pfNum >= 0f) lfNum = pfNum + .0025f; else lfNum = pfNum - .0025f; return lfNum; |
int | GetMoneyAmount(int amount, int CheckAmount) Get Money Amount if (amount >= CheckAmount) { int left = amount / CheckAmount; if (left > 0) { return left; return 0; |
boolean | isMoney(String money) is Money if (!isNumber(money)) { return false; if (money.equals("0")) { return false; for (int i = 0; i < money.length(); i++) { char ch = money.charAt(i); ... |
boolean | isMoney(String money) is Money money = money.trim(); if (money.startsWith("$")) { return (false); if (money.length() > 0 && money.trim().matches("^(\\d*(\\.\\d\\d?)?|\\d+)$")) { return (true); } else { return (false); ... |
boolean | isMoney(String str) is Money for (int i = 0; i < str.length(); i++) { if (!Character.isDigit(str.charAt(i))) return false; return true; |
boolean | isMoney(String[] Moneys, String key) is Money if (Moneys.length == 0) return false; for (String moneyKey : Moneys) { if (moneyKey.equals(key)) { return true; return false; ... |
String | moneyChange(String money) money Change int index = money.indexOf("."); String head = money.substring(0, index); String end = money.substring(index + 1); if (head.equals("0")) { if (end.startsWith("0")) { return Integer.parseInt(end) + ""; return end; ... |
String | moneyFenToYuan(String amount) money Fen To Yuan if (isEmpty(amount)) { return amount; if (amount.indexOf(".") > -1) { return amount; if (amount.length() == 1) { return "0.0" + amount; ... |