List of utility methods to do Number Format Pattern
String | getNumberComma(String number) Insert comma to String NumberFormat fmt = NumberFormat.getInstance();
String strNumber = fmt.format(Double.valueOf(number));
return strNumber;
|
NumberFormat | getNumberFormat() get Number Format NumberFormat nf = NumberFormat.getIntegerInstance(SITEMAP_LOCALE);
nf.setMinimumFractionDigits(5);
return nf;
|
NumberFormat | getNumberFormat() get Number Format return numberFormat;
|
String | getNumberFormat(BigDecimal num, final int digits) get Number Format String thenum = ""; if (num == null) { num = new BigDecimal(0); try { final NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(digits); nf.setMinimumFractionDigits(digits); ... |
double | getNumberFormat(double d) format the double number DecimalFormat format = new DecimalFormat("###0.000000"); String str = ""; str = format.format(d); double e = Double.parseDouble(str); return e; |
NumberFormat | getNumberFormat(final String pattern) get Number Format DecimalFormat df = new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(Locale.ENGLISH)); return df; |
NumberFormat | getNumberFormat(int maximumFractionDigits) Return a number formatter with maximum fraction digits, no grouping, locale ENGLISH. NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
format.setMaximumFractionDigits(maximumFractionDigits);
format.setGroupingUsed(false);
return format;
|
NumberFormat | getNumberFormat(String format, Locale locale) Returns a NumberFormat instance for the specified format and Locale . if (format == null || locale == null) { return null; NumberFormat nf = null; int style = getNumberStyleAsInt(format); if (style < 0) { nf = new DecimalFormat(format, new DecimalFormatSymbols(locale)); } else { ... |
DecimalFormat | getNumberFormat(String localeStr) get Number Format DecimalFormat nf = numberformatMap.get(localeStr); if (nf == null) { Locale locale = new Locale(localeStr); nf = (DecimalFormat) NumberFormat.getInstance(locale); numberformatMap.put(localeStr, nf); return nf; |
NumberFormat | getNumberFormatFromCache(Locale locale, Currency currency) Provides a cached approach for creating NumberFormat instances. String key = locale.toString() + currency.getCurrencyCode(); if (!FORMAT_CACHE.containsKey(key)) { NumberFormat format = NumberFormat.getCurrencyInstance(locale); format.setCurrency(currency); FORMAT_CACHE.put(key, format); return FORMAT_CACHE.get(key); |