it would be nice if you try to design a method that has a parameter "String" and will return a boolean that represents true if the value receive is an integer or false otherwise.
What came first on mind is to put them on try/catch block.
boolean isInteger(String test){
try{
Integer.parseInt(test);
return true;
}catch(Exception e){
return false;
}
}
then invoke that method like
if(isInteger("7852862"))
do something;
else
jump;
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by sukatoa : 05-13-2008 at 06:30 AM.
|