Possible Duplicate:
Java: Good way to encapsulate Integer.parseInt()
how to convert a string to float and avoid using try/catch in java?
C# has Int.TryParse: Int32.TryParse Method (String, Int32%)
The great thing with this method is that it doesn't throw an exception for bad data.
In java, Integer.parseInt("abc")
will throw an exception, and in cases where this may happen a lot performance will suffer.
Is there a way around this somehow for those cases where performance is an issue?
The only other way I can think of is to run the input against an regex, but I have to test to see what is faster.