List of utility methods to do Money Format
String | formatMoney(double money, int scalar) format Money String zero = "000000000000000000000000000000"; String format = "###,##0." + zero.substring(0, scalar); NumberFormat nf = new DecimalFormat(format); return nf.format(money); |
String | formatMoney(int dosh) format Money String ret = CURRENCY_SYMBOL + String.valueOf(dosh);
return ret;
|
double | formatMoney(Object str) format Money DecimalFormat df = new DecimalFormat("0.00"); return Double.valueOf(df.format(str)).doubleValue(); |
String | formatMoney(String money) format Money if (money == null) return ""; try { money = money.trim(); double d = Double.parseDouble(money); return formatMoney(d); } catch (Exception e) { System.err.println(e); ... |
String | formatMoneyNoSymbol(int pennies) format Money No Symbol return String.format("%.2f", ((double) pennies / 100)); |
String | formatMoneyShort(int pennies) format Money Short if (pennies % 100 == 0) { return "£" + (pennies / 100); } else { return formatMoney(pennies); |
String | formatMoneyVI(String money) format Money VI try { java.text.DecimalFormat df = new java.text.DecimalFormat("#,##0.00"); return df.format(Double.parseDouble(money)); } catch (NumberFormatException e) { return null; |
String | formatOfRead(BigDecimal money) format Of Read DecimalFormat format = new DecimalFormat("###,##0.00"); format.setRoundingMode(RoundingMode.HALF_UP); return format.format(money); |
String | formatThousandMoney(String moneyStr) format Thousand Money int money = Integer.valueOf(moneyStr).intValue(); return money == 0 ? "" : Integer.toString(money); |
String | getMoneyFormat(double money) get Money Format DecimalFormat df = new DecimalFormat("#,##0.00"); return df.format(money); |