Java tutorial
//package com.java2s; public class Main { public static double toDouble(Object srcStr, double defaultValue) { try { if (srcStr != null) { return Double.valueOf(srcStr.toString().replaceAll(",", "")); } } catch (Exception e) { ; } return defaultValue; } public static String toString(Object obj) { if (null == obj) { return ""; } return obj.toString(); } public static String toString(Object obj, String defaultStr) { if (null == obj) { return defaultStr; } return obj.toString(); } }