Java Double Number Create toDouble(Object obj)

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

Description

to Double

License

Open Source License

Declaration

public static double toDouble(Object obj) 

Method Source Code

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

public class Main {
    public static double toDouble(Object obj) {
        String str = obj != null ? obj.toString().trim() : "";
        return "".equals(str) ? 0.00 : Double.parseDouble(str);
    }/*from w  ww .  java  2 s . c om*/

    public static double toDouble(Object obj, double doubleStr) {
        String str = obj != null ? obj.toString().trim() : "";
        return "".equals(str) ? doubleStr : Double.parseDouble(str);
    }

    public static String toString(Object obj) {
        return obj != null ? obj.toString() : "";
    }

    public static String toString(Object obj, String str) {
        return obj != null ? obj.toString() : str;
    }
}

Related

  1. toDouble(Object o)
  2. toDouble(Object ob, Double defaultDouble)
  3. toDouble(Object obj)
  4. toDouble(Object obj)
  5. toDouble(Object obj)
  6. toDouble(Object obj)
  7. toDouble(Object obj)
  8. toDouble(Object obj)
  9. toDouble(Object obj)