Why not just use Integer.parseInt(s)? No need to create a throwaway
Integer object. In
either case, don't bother assigning it to anything.
Lastly, use the specific exception, NumberFormatException. It's clearer.
public static boolean isNumeric(String s) {
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
}
... much nicer ;^)
--
Lee Fesperman, FFE Software, Inc. (
http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (
http://www.firstsql.com)