|
-
Oct 29th, 2002, 04:43 PM
#1
Thread Starter
New Member
how do i catch Exception
if i ask for a string through bufferReader i.e
a telephone number 5554444
how can i stop a letter being entered instead of a number
thanks
-
Oct 29th, 2002, 04:59 PM
#2
Not directly. You could read character per character and check each one. Or you could use a read-integer function (don't know if there is one), but it wouldn't hinder the user from entering a letter, it would only make the function throw an exception.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 29th, 2002, 05:10 PM
#3
Thread Starter
New Member
thanks i will check that way out
-
Nov 1st, 2002, 09:11 PM
#4
Addicted Member
or u can put the string u get into Integer.parseInt(String s)
if this can't make it into an integer it throws an exception
Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|