Java Double Number Create toDouble(String str)

Here you can find the source of toDouble(String str)

Description

to Double

License

Mozilla Public License

Declaration

public static double toDouble(String str) 

Method Source Code

//package com.java2s;
//License from project: Mozilla Public License 

public class Main {
    public static double toDouble(String str) {
        return toDouble(str, 0.0d);
    }//from   w  ww .  j  av  a  2s .c om

    public static double toDouble(String str, double defaultValue) {
        if (str == null) {
            return defaultValue;
        }

        try {
            return Double.parseDouble(str);
        } catch (NumberFormatException nfe) {
            return defaultValue;
        }
    }
}

Related

  1. toDouble(String s)
  2. toDouble(String s)
  3. toDouble(String s)
  4. toDouble(String str)
  5. toDouble(String str)
  6. toDouble(String str)
  7. toDouble(String str)
  8. toDouble(String str)
  9. toDouble(String str, double defaultValue)