List of utility methods to do Double Number to String
String | double2String(double d) double String return (double2String(d, 5)); |
String | double2String(double value) double String DecimalFormat format = new DecimalFormat("0.##"); DecimalFormatSymbols symbols = format.getDecimalFormatSymbols(); symbols.setDecimalSeparator('.'); format.setDecimalFormatSymbols(symbols); format.setDecimalSeparatorAlwaysShown(false); return format.format(value); |
String[] | doublesToStrings(final double... numbers) doubles To Strings if (numbers == null) { return null; final String[] strings = new String[numbers.length]; int index = 0; for (final double number : numbers) { strings[index++] = doubleToString(number); return strings; |
String | doubleToAtLeastString(double d, int length) return a string that is at least a certain number of characters in length. NumberFormat formatter = new DecimalFormat("0.000"); String s = formatter.format(d); for (int i = s.length(); i < length; i++) { s += "0"; return s; |
String | doubleToCoreString(double number) double To Core String return coreDoubleFormat_.format(number);
|
String | doubleToDollarString(double val) double To Dollar String return NumberFormat.getCurrencyInstance().format(val); |
String | doubleToFixedString(double d, int length) double To Fixed String String s = doubleToAtLeastString(d, length); if (s.charAt(0) != '-') { return " " + s.substring(0, length - 1); return s.substring(0, length); |
String | doubleToScientificString(double number, int fractionDigits) Returns the string representation of the given double value in normalized scientific notation. DecimalFormat format = new DecimalFormat(); StringBuilder formatter = new StringBuilder(5 + fractionDigits).append("0."); for (int i = 0; i < fractionDigits; i++) { formatter.append('0'); formatter.append("E00"); format.applyPattern(formatter.toString()); String formatted = format.format(number); ... |
String | doubleToStr(double d) double To Str String rtn = ""; java.text.DecimalFormat df = new java.text.DecimalFormat("###0.000000"); rtn = df.format(d); return cutZero(rtn); |
String | doubleToStr(double origin, int decimals) Formats a double to produce a string with a number of fraction digits. return getFormat(decimals).format(new Double(origin)); |