Java Utililty Methods Double Parse

List of utility methods to do Double Parse

Description

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

Method

DoubletryParseDouble(Object o)
Given an Object that may be null or may be a float or double, this method attempts to convert the value to a Double.
if (o == null)
    return null;
Double retVal = null;
try {
    retVal = Double.parseDouble(o.toString().trim());
} catch (NumberFormatException nfe) {
return retVal;
...
DoubletryParseDouble(Object obj, Double defaultVal)
try Parse Double
if (obj == null)
    return defaultVal;
if (obj instanceof Double)
    return (Double) obj;
try {
    String val = obj.toString();
    return Double.parseDouble(val);
} catch (Exception e) {
...
ObjecttryParseDouble(String doubleValue)
try Parse Double
Object parsedValue;
try {
    parsedValue = Double.parseDouble(doubleValue);
} catch (NumberFormatException nfe) {
    parsedValue = doubleValue;
return parsedValue;
DoubletryParseDouble(String value)
Try to parse the string as double or return null if failed
try {
    return Double.parseDouble(value);
} catch (NumberFormatException e) {
    return null;
doubletryParseDouble(String value)
try Parse Double
try {
    return Double.parseDouble(value);
} catch (NumberFormatException e) {
    return -1;