View Single Post
  #2 (permalink)  
Old 05-13-2008, 06:25 AM
sukatoa's Avatar
sukatoa sukatoa is offline
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
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.

Code:
boolean isInteger(String test){ try{ Integer.parseInt(test); return true; }catch(Exception e){ return false; } }
then invoke that method like

Code:
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.
Reply With Quote