List of utility methods to do Decimal Format
double | toParse(double d) to Parse double resultado; Locale locale = new Locale("en", "UK"); String pattern = "###.##"; DecimalFormat decimalFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale); decimalFormat.applyPattern(pattern); String format = decimalFormat.format(d); resultado = Double.parseDouble(format); return resultado; ... |
String | toPrecision(double I, int digits1, int digits2) to Precision if (digits2 == 0) return (String.valueOf((int) Math.round(I))); StringBuffer strbuf = new StringBuffer(""); for (int i = 0; i < digits1 - 1; i++) strbuf.append("#"); strbuf.append("0."); for (int i = 0; i < digits2; i++) strbuf.append("#"); ... |
String | toScientific(double I, int digits) to Scientific StringBuffer strbuf = new StringBuffer("0."); for (int i = 0; i < digits; i++) strbuf.append("#"); strbuf.append("E0"); DecimalFormat df = new DecimalFormat(strbuf.toString()); return (df.format(I)); |
String | toSplitDecimalString(Double num, int decimal) to Split Decimal String if (num == null) { return ""; String str = num.toString(); String formatStr = "###,###."; for (int i = 0; i < decimal; ++i) { formatStr = formatStr + "0"; DecimalFormat df = new DecimalFormat(formatStr); try { str = df.format(num); } catch (Exception localException) { return str; |
String | toStockPrice(double value) Convert the value to stock price representation. return stockPriceNumberFormat.get().format(value);
|
String | toString(double d) to String return SIMPLE_ORDINATE_FORMAT.format(d);
|
String | toString(double d) to String return new DecimalFormat("#,##0.00").format(d); |
String | toString(double d, int precision) to String StringBuffer sb = new StringBuffer(); if (precision > 0) { DecimalFormat df = getFormatter(precision); sb.append(df.format(d)); } else { sb.append(d); return sb.toString(); ... |
String | toString(double value) Converts a double to a string without the trailing fractional zero. return new DecimalFormat("0.#################").format(value); |
String | toString(double value) to String value = round(value); if (value % 1 == 0) { return NumberFormat.getNumberInstance().format((int) value); return NumberFormat.getNumberInstance().format(value); |