Java examples for java.lang:String Parse
safe Parse Double
//package com.java2s; public class Main { public static void main(String[] argv) { String toParse = "java2s.com"; System.out.println(safeParseDouble(toParse)); }//from w w w . ja va2s . co m public static Double safeParseDouble(String toParse) { try { return Double.valueOf(toParse); } catch (NumberFormatException e) { return null; } } }