List of utility methods to do Currency Format
String | formatCurrency(int amount) Returns the amount as a formatted currency amount for the locale. NumberFormat nf = NumberFormat.getCurrencyInstance(); return nf.format(((double) amount) / 100); |
String | formatCurrency(Number currencyValue) Method formatCurrency. if (currencyValue == null) return ""; if (currencyValue.doubleValue() == currencyValue.longValue()) return "" + currencyValue.longValue(); else { NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(2); nf.setMinimumFractionDigits(2); ... |
String | formatCurrency(Object value) format Currency NumberFormat m_currencyformat = NumberFormat.getCurrencyInstance();
return m_currencyformat.format(((Number) value).doubleValue());
|
String | formatCurrency(String currency) currency fomate if ((null == currency) || "".equals(currency) || "null".equals(currency)) { return ""; NumberFormat usFormat = NumberFormat.getCurrencyInstance(Locale.CHINA); try { return usFormat.format(Double.parseDouble(currency)); } catch (Exception e) { return ""; ... |
String | formatCurrencyWithCurrencyUnit(double amt, int fractionDigits) format Currency With Currency Unit NumberFormat nf = getCurrencyFormat(fractionDigits); String currAmt = nf.format(amt); String symbol = (nf instanceof DecimalFormat) ? ((DecimalFormat) nf).getDecimalFormatSymbols().getCurrencySymbol() : ""; if (symbol.length() == 1) { currAmt = currAmt + " " + nf.getCurrency(); return currAmt; |
NumberFormat | getCurrencyFormat() get Currency Format return getCurrencyFormat(2);
|
NumberFormat | getCurrencyFormat(final Locale locale) get Currency Format return getNumberFraction2Format(locale);
|
NumberFormat | getCurrencyFormatter() get Currency Formatter return currencyFormatterTl.get();
|
double | parseCurrency(String currency) Returns the currency string as a double value NumberFormat nf = NumberFormat.getCurrencyInstance();
return nf.parse(currency).doubleValue();
|
BigDecimal | removeTrailingZeroes(BigDecimal value, boolean isCurrency) Convert BigDecimal to currency or quantity. if (value == null) { return null; DecimalFormat df; if (isCurrency) { df = new DecimalFormat("0.00####"); } else { df = new DecimalFormat("0.######"); ... |