How to check that a string is parseable to a double?

Louis Rhys picture Louis Rhys · Aug 23, 2010 · Viewed 141.9k times · Source

Is there a native way (preferably without implementing your own method) to check that a string is parseable with Double.parseDouble()?

Answer

bluedevil2k picture bluedevil2k · Aug 23, 2010

Apache, as usual, has a good answer from Apache Commons-Lang in the form of NumberUtils.isCreatable(String).

Handles nulls, no try/catch block required.