Java Double Number Create toDouble(Object val)

Here you can find the source of toDouble(Object val)

Description

to Double

License

Apache License

Declaration

public static Double toDouble(Object val) 

Method Source Code

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

public class Main {

    public static Double toDouble(Object val) {
        if (val == null) {
            return 0D;
        }//ww  w  . j a  va2 s . co m
        try {
            return Double.valueOf(trim(val.toString()));
        } catch (Exception e) {
            return 0D;
        }
    }

    public static String trim(String str) {
        return (null == str) ? null : str.trim();
    }
}

Related

  1. toDouble(Object object, double defaultValue)
  2. toDouble(Object object, Double defaultValue)
  3. toDouble(Object objValue)
  4. toDouble(Object prmIntObject)
  5. toDouble(Object val)
  6. toDouble(Object val)
  7. toDouble(Object value)
  8. toDouble(Object value)
  9. toDouble(Object value)