Depends on what kind of number you are expecting. If you are expecting an integer, try to parse it as an int. If it won't parse, it's not a number. You can do the same thing if you are expecting a FP number using Double or Float classes.
int myNum;
try {
myNum = Integer.parseInt(theString);
} catch (NumberFormatException e) {
// It's NOT a number
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.