Java Double Number Create toDouble(String string)

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

Description

string2Double

License

Open Source License

Parameter

Parameter Description
string a parameter

Return

double

Declaration

public static double toDouble(String string) 

Method Source Code

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

public class Main {
    /**//from w  w w.  j  ava  2s  . c o m
     * string2Double
     *
     * @param string
     * @return double
     */
    public static double toDouble(String string) {
        String str = trim(string);
        if ("".equals(str))
            str = "0.0";
        return Double.parseDouble(str);
    }

    /**
     * trim
     * 
     * @param string
     * @return
     */
    public static String trim(String string) {
        if (string == null)
            return "";
        else
            return string.trim();
    }
}

Related

  1. toDouble(String str)
  2. toDouble(String str)
  3. toDouble(String str)
  4. toDouble(String str)
  5. toDouble(String str, double defaultValue)
  6. ToDouble(String string)
  7. toDouble(String v, double def)
  8. toDouble(String val)
  9. toDouble(String value)