Here you can find the source of toDouble(String value)
Parameter | Description |
---|---|
value | a value string |
Parameter | Description |
---|---|
IllegalArgumentException | if format error has occured |
static Double toDouble(String value) throws IllegalArgumentException
//package com.java2s; //License from project: BSD License public class Main { /**/*from w w w . ja v a 2 s . co m*/ * Converts the specified value string to the Double value. * If the specified string is null or blank, this method returns null. * * @param value a value string * @return a {@code Double} object * @throws IllegalArgumentException if format error has occured */ static Double toDouble(String value) throws IllegalArgumentException { if (value == null || value.equals("")) { //the option not specified or a blank value specified return null; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("invalid boolean value : " + value); } } }