Java Utililty Methods Parse Double

List of utility methods to do Parse Double

Description

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

Method

StringparseDouble(Double data)
parse Double
NumberFormat nf = new DecimalFormat("#,###");
return nf.format(Math.round(data));
DoubleparseDouble(Object input)
DOC Zqin Comment method "parseDouble".
if (input != null) {
    DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
    try {
        Number number = format.parse(input.toString());
        return number.doubleValue();
    } catch (ParseException e) {
        return Double.NaN;
return null;
DoubleparseDouble(String d)
parse Double
DecimalFormat format = new DecimalFormat("#.##");
return format.parse(d.toUpperCase().replace("+", "")).doubleValue();
doubleparseDouble(String inStr)
parse Double
try {
    NumberFormat nf = NumberFormat.getInstance(sLocale);
    Number n = nf.parse(inStr);
    return n.doubleValue();
} catch (ParseException e) {
    return Double.parseDouble(inStr);
doubleparseDouble(String s, Locale locale)
Parse a numeric string using the specified locale.
if (s == null || s.isEmpty()) {
    return Double.NaN;
try {
    return NumberFormat.getNumberInstance(locale).parse(s).doubleValue();
} catch (ParseException ex) {
    try {
        return NumberFormat.getNumberInstance(Locale.US).parse(s).doubleValue();
...
doubleparseDouble(String str)
parse Double
return parseDouble(str, Locale.getDefault());
DoubleparseDouble(String str)
parse Double
try {
    DecimalFormat df = new DecimalFormat("#,##0.0#");
    return Double.valueOf(String.valueOf(df.parseObject(str)));
} catch (Exception e) {
    return new Double(0.0);
doubleparseDouble(String stringValue)
parse Double
return parseNumber(stringValue).doubleValue();
doubleparseDouble(String value)
Parse a string containing a double with locale specific formatting e.g.
return Double.parseDouble(parsePrepare(value));
doubleParseDoubleEx(String s, double value_if_fault)
Parse a string containing a double.
int pos, step;
double v;
String str, s1;
boolean ok, error;
char decimalseparator = new DecimalFormat().getDecimalFormatSymbols().getDecimalSeparator();
v = 0.0;
str = "";
s1 = s.trim();
...