Java Double Number Create toDouble(String s)

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

Description

Translate a string s to a Double.

License

Open Source License

Parameter

Parameter Description
s is the string to parse as a Double

Return

the double translation of string s, or return null if s is not a double/integer.

Declaration

public static Double toDouble(String s) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from w ww.jav  a 2  s.c o m*/
     * Translate a string s to a Double.
     *
     * @param s is the string to parse as a Double
     * @return the double translation of string s, or return null if s is not a
     * double/integer.
     */
    public static Double toDouble(String s) {
        Double i = null;
        try {
            i = Double.parseDouble(s);
        } catch (NumberFormatException e) {
            // leave i = null
        }
        return i;
    }
}

Related

  1. toDouble(short[] src)
  2. toDouble(String aString)
  3. toDouble(String doubleString, Double defaultValue)
  4. toDouble(String input, double defaultValue)
  5. toDouble(String parameter)
  6. toDouble(String s)
  7. toDouble(String s)
  8. toDouble(String s)
  9. toDouble(String str)