Java Double Number Create toDouble(final String value)

Here you can find the source of toDouble(final String value)

Description

To double.

License

Apache License

Parameter

Parameter Description
value the value

Return

the double

Declaration

public static double toDouble(final String value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//w  ww.  j  av  a 2s .  c  o  m
     * To double.
     *
     * @param value the value
     * @return the double
     */
    public static double toDouble(final String value) {
        if (value == null) {
            return 0.0D;
        }

        String szTemp = "";

        for (int i = 0; i < value.length(); i++)
            if (value.charAt(i) != ',') {
                szTemp = szTemp + value.charAt(i);
            }

        try {
            final double d = Double.parseDouble(szTemp);

            return d;
        } catch (final NumberFormatException e) {
            final double d1 = 0.0D;

            return d1;
        }
    }
}

Related

  1. toDouble(final Object obj)
  2. toDouble(final Object value)
  3. toDouble(final Object valueRep)
  4. toDouble(final String argStr)
  5. toDouble(final String value)
  6. toDouble(float in1)
  7. toDouble(float[] a)
  8. toDouble(float[] a)
  9. toDouble(float[] array)