Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to found out that the output is a Integer or String.

Status
Not open for further replies.

Jeff100

Technical User
Feb 27, 2006
1
GB
How to found out that the output is a Integer or String. I has to read data from file which is having data ( abcd 34 addfd 35 dsasd 445.66 asdads .....). When i use tokenizer, i am getting output but i don't know whether it is number or string. how to found that the output is integer.
 
Jeff,

You can look at individual characters using Character.isDigit() public static boolean isDigit(char ch) OR you can use Interger.parseInt() public static int parseInt(String s) throws NumberFormatException, which ever one suits your solution best.

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top