Java Utililty Methods Double to String

List of utility methods to do Double to String

Description

The list of methods to do Double to String are organized into topic(s).

Method

StringconvertDoubleToString(double value)
convert Double To String
return Double.toString(value);
StringconvertDoubleToString(double value)
convert Double To String
if (Double.isInfinite(value)) {
    return (value < 0.0) ? "-Inf" : "+Inf";
return String.format("%f", value);
Stringdouble2str(double amount, int length)
doublestr
String strAmt = Double.toString(amount);
int pos = strAmt.indexOf('.');
if (pos != -1 && strAmt.length() > length + pos + 1)
    strAmt = strAmt.substring(0, pos + length + 1);
return strAmt;
Stringdouble2str(double d, int noOfDecimalDigit)
doublestr
String str = "";
String ds = Double.toString(d);
if (d == 0)
    ds = "0." + generateZeros(noOfDecimalDigit);
if (ds.length() < noOfDecimalDigit + 2)
    ds = ds + generateZeros(noOfDecimalDigit + 2 - ds.length());
int delimiterIndex = ds.indexOf(".");
int decLen = ds.substring(delimiterIndex, ds.length()).length() - 1;
...
Stringdouble2string(double doubledata)
doublestring
return String.valueOf(doubledata);
Stringdouble2String(double[] v)
converts a double array to a comma-separated string
StringBuilder builder = new StringBuilder();
for (double aV : v) {
    builder.append(aV).append(',');
return builder.toString();
StringdoubleToStr(Double d)
double To Str
String str = d.toString();
if (str != null && !"".equals(str)) {
    if (str.endsWith(".0")) {
        str = str.substring(0, str.lastIndexOf(".0"));
        return str;
    return str;
return "";
StringdoubleToStr(Double valor)
double To Str
return String.valueOf(valor);
StringdoubleToString(double d)
double To String
int length;
if (d < 0.0) {
    length = DOUBLE_BYTE;
} else {
    length = DOUBLE_BYTE - 1;
double db = 1.0;
for (int i = 1; i < length; i++) {
...
StringdoubleToString(double d)
Erstellt aus einem double einen String.
if (d % 1 == 0) {
    return Integer.toString((int) d);
} else {
    return Double.toString(d);