Possible Duplicate:
How to check a String is a numeric type in java
I see I can parse a String
into a double
by using Double.parseDouble
.
Since that one might throw a NumberFormatException
, and I don´t want to do programming by exception, I hesitate to put the parseDouble
call into a try
/catch
block just to check if the string can be parsed into a double
.
In Delphi, there is TryParseInt
(I think), which returns a defined value (-1 I think) if the string cannot be parsed into an Integer
.
There is nothing like that in Java? I mean: there is no standard way to do this?