Here you can find the source of parseDouble(Object object)
public static double parseDouble(Object object)
//package com.java2s; //License from project: LGPL import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static final String regexDouble = "^-?\\d+(\\.\\d)*"; public static double parseDouble(Object object) { if (null == object) return 0.0; String str = object.toString(); if ("".equals(str)) return 0.0; str = getFirstMatcher(regexDouble, str); return Double.parseDouble(str); }/* w w w.ja v a 2s .co m*/ public static String getFirstMatcher(String regex, String str) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(str); while (matcher.find()) { return matcher.group(); } return null; } }