List of utility methods to do Double Number Format
boolean | isDoubleWhitFormat(String pValue) is Double Whit Format try { if (!pValue.equals("")) { java.text.DecimalFormat formatDecimal = new java.text.DecimalFormat("###,##0.00"); java.text.DecimalFormatSymbols symbols = new java.text.DecimalFormatSymbols(); symbols.setGroupingSeparator(','); symbols.setDecimalSeparator('.'); formatDecimal.setDecimalFormatSymbols(symbols); double valor = formatDecimal.parse(pValue).doubleValue(); ... |
String | prettyDecimalFormat(double d, int numPlaces) pretty Decimal Format StringBuilder sb = new StringBuilder("#."); for (int i = 0; i < numPlaces; i++) { sb.append("#"); DecimalFormat dFormat = new DecimalFormat(sb.toString()); return dFormat.format(d); |
String | roundFormat(double d, int i) round Format String num = null; if (i == 1) { num = "0.0"; if (i == 2) { num = "0.00"; if (i == 3) { ... |
String | shorten(double num) shorten String string = Double.toString(num); if (Integer.parseInt(string.split("\\.")[1]) == 0) { return string.split("\\.")[0]; } else { DecimalFormat format = new DecimalFormat("0.##"); return format.format(num); |
double | toDoubleFromHumanFormat(String doubleAsString) to Double From Human Format NumberFormat formatter = NumberFormat.getInstance();
return formatter.parse(doubleAsString).doubleValue();
|
String | toString(double in, String format) to String DecimalFormat formatter = new DecimalFormat(format); return formatter.format(in); |
String | toString(double[] arr, NumberFormat nf) Copies the given array, using a standard scientific notation number formatter and beginning each line with the given lineInit. String result; if (nf == null) { throw new NullPointerException("NumberFormat must not be null."); if (arr == null) { result = nullMessage(); } else { StringBuilder buf = new StringBuilder(); ... |
String | toString(double[] y, Format format) to String StringBuffer sb = new StringBuffer(); for (int i = 0; i < y.length - 1; i++) { sb.append(format.format(y[i]) + " "); sb.append(format.format(y[y.length - 1]) + " "); return sb.toString(); |