List of utility methods to do String to Double
double | asDouble(final String str, final double def) Parse string to double, if string can't be parsed to double, then it will return given default value. try { return Double.parseDouble(str); } catch (final NumberFormatException e) { return def; |
double | asDouble(String str) as Double try { return Double.valueOf(str); } catch (NumberFormatException nfex) { return Double.NaN; |
Double | asDouble(String string) Converts string to double return (string == null) ? null : Double.valueOf(string);
|
double | asDouble(String value) Converts a String value into a double .
return Double.parseDouble(value == null ? value : value.trim());
|
float | atof(String pString_) String to float converter. float fRetVal = 0.0f; if (isEmpty(pString_)) { return fRetVal; try { fRetVal = Float.valueOf(pString_).floatValue(); } catch (NumberFormatException pNumberFormatException) { fRetVal = Float.NaN; ... |
double | atof(String s) atof double d = Double.valueOf(s).doubleValue(); if (Double.isNaN(d) || Double.isInfinite(d)) { System.err.print("NaN or Infinity in input\n"); System.exit(1); return (d); |
double | atof(String s) Returns the double value of s. int i, numMinuses = 0, numDots = 0; s = s.trim(); for (i = 0; i < s.length() && (s.charAt(i) == '-' || s.charAt(i) == '.' || Character.isDigit(s.charAt(i))); i++) if (s.charAt(i) == '-') numMinuses++; else if (s.charAt(i) == '.') numDots++; ... |
double | atof(String s) atof if (s == null || s.length() < 1) throw new IllegalArgumentException("Can't convert empty string to double"); double d = Double.parseDouble(s); if (Double.isNaN(d) || Double.isInfinite(d)) { throw new IllegalArgumentException("NaN or Infinity in input: " + s); return (d); |
double | convertStringToDouble(String num) convert String To Double double val = 0; if (num != null) { val = Double.parseDouble(num); return val; |
Double | convertStringToDouble(String number) Return the Double value of the input string. if (number == null) { return null; try { return Double.parseDouble(number); } catch (NumberFormatException e) { return null; |