List of utility methods to do Double Number Parse
Double | toDouble(final Object o, final String pattern) to Double if (o == null) { return null; } else if (o instanceof Double) { return (Double) o; } else if (o instanceof Number) { return new Double(((Number) o).doubleValue()); } else if (o instanceof String) { return toDouble((String) o); ... |
double | toDouble(Locale locale, String value) to Double value = value.trim(); ParsePosition pos = new ParsePosition(0); Number result = NumberFormat.getInstance(locale).parse(value, pos); if (pos.getIndex() != value.length()) throw new NumberFormatException("Could not parse: " + value); return result.doubleValue(); |
boolean | tryParseDoubleValue(String s, double[] result) Try parse integer value from a string value NumberFormat format = NumberFormat.getNumberInstance(); ParsePosition position = new ParsePosition(0); Object parsedValue = format.parseObject(s, position); if (position.getErrorIndex() > -1) { return false; if (position.getIndex() < s.length()) { return false; ... |