List of utility methods to do Decimal Format
String | getDecimalFormat(String format, String sNumber) get Decimal Format DecimalFormat nf = new DecimalFormat(format); return nf.format((long) Integer.parseInt(sNumber)); |
DecimalFormat | getDecimalFormat(String pattern) get Decimal Format DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator('.'); DecimalFormat format = new DecimalFormat(pattern); format.setDecimalFormatSymbols(symbols); return format; |
DecimalFormat | getDecimalFormatFix1() get Decimal Format Fix if (decFmtFix1 == null) { NumberFormat numFmt = NumberFormat.getNumberInstance(); if (numFmt instanceof DecimalFormat) { decFmtFix1 = (DecimalFormat) numFmt; } else { decFmtFix1 = new DecimalFormat(); decFmtFix1.applyPattern("###,##0.0"); ... |
DecimalFormatSymbols | getDecimalFormatSymbols(Locale locale) get Decimal Format Symbols DecimalFormatSymbols symbols = (DecimalFormatSymbols) symbolsCache.get(locale); if (symbols == null) { symbols = new DecimalFormatSymbols(locale); symbolsCache.put(locale, symbols); return symbols; |
DecimalFormatSymbols | getDecimalFormatSymbols(final Locale locale) get Decimal Format Symbols DecimalFormatSymbols symbol; if (locale != null) { symbol = DecimalFormatSymbols.getInstance(locale); } else { symbol = DecimalFormatSymbols.getInstance(); return symbol; |
String | getDecimalFormattedNoQuote(String englishFormat) get Decimal Formatted No Quote return englishFormat.replace('.', getDecimalSeparator()); |
NumberFormat | getDecimalFormatter() get Decimal Formatter NumberFormat format = DecimalFormat.getNumberInstance();
format.setMinimumFractionDigits(1);
format.setMaximumFractionDigits(1);
return format;
|
NumberFormat | getDecimalFormatter(int scale) Obtin un formatter pentru o anumita scara if (scale != formaterScale) initializeDecimalFormat(scale); return decimalFormater; |
int | getDigitNumber(double p) get Digit Number NumberFormat formatter = new DecimalFormat(); formatter = new DecimalFormat("0.######E0"); String s = formatter.format(p); String ss = s.substring(s.indexOf("E") + 1); return Integer.parseInt(ss); |
String | getDoubleAsString(double value) get Double As String if (value % 1 != 0) { return String.valueOf(value); } else { return decimalFormat.format(value); |