check if a string is anumber java regex code example
Example: java check if string is number
try {
int n = Integer.parseInt(str);
} catch (NumberFormatException e) {
// str is not a number
}
try {
int n = Integer.parseInt(str);
} catch (NumberFormatException e) {
// str is not a number
}