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!

newbie question - reading in data

Status
Not open for further replies.

cyberspace

Technical User
Aug 19, 2005
968
GB
I am doing some java basic exercises and I want a program to read in my data but only accept it if it is an int, ie 555 would be accepted but "dsfdfsdf" would produce an error and then prompt again...

My programming comes mainly from web development background where ereg has been the saviour although sadly it's not so easy in Java!

Thanks :)

'When all else fails.......read the manual'
 
Have a look at
Code:
Integer.parseInt(String s);

in the Java Api Docs.

Tim
 
thanks chaps, that's really helpful :)

'When all else fails.......read the manual'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top