Java Double Number Create toDouble(String value, Double fallback)

Here you can find the source of toDouble(String value, Double fallback)

Description

to Double

License

Open Source License

Declaration

public static Double toDouble(String value, Double fallback) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static Double toDouble(String value, Double fallback) {

        if (value == null || value.isEmpty()) {
            return fallback;
        }/*from   w  w  w .j  ava2s .  c o  m*/

        try {
            return Double.valueOf(value);
        } catch (Exception e) {
            return fallback;
        }
    }
}

Related

  1. toDouble(String value)
  2. toDouble(String value, double defaultValue)
  3. toDouble(String value, double defaultValue)
  4. toDouble(String value, double defaultValue)
  5. toDouble(String value, Double defaultValue)
  6. toDouble(T value)