Home arrow static arrow Java Programming [Archive] - How to check user input?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - How to check user input?
This topic has 4 replies on 1 page.

Posts:3
Registered: 7/31/04
How to check user input?  
Jul 31, 2004 6:33 AM



 
I'd like to check whether the user inputs alphabet and numeric input. What should I do to achieve this one? I have try to catch the user input by using string. I manage to check every char. within and I got stuck with it. Could anybody here help me please. Thank you very much for your idea and help.
 

Posts:47
Registered: 4/1/03
Re: How to check user input?  
Jul 31, 2004 6:56 AM (reply 1 of 4)



 
check input ?
yes,i agree with you about check every char,but which char is illegal ?
 

Posts:11,200
Registered: 7/22/99
Re: How to check user input?  
Jul 31, 2004 6:56 AM (reply 2 of 4)



 
The Character class has several methods for classifying chars.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Character.html
System.out.println(Character.isLetter('A')); // trueSystem.out.println(Character.isLetter('1')); // false System.out.println(Character.isDigit('A')); // falseSystem.out.println(Character.isDigit('1')); // true
 

Posts:3
Registered: 7/31/04
Re: How to check user input?  
Jul 31, 2004 9:02 PM (reply 3 of 4)



 
Hi...

Thank you very much. Your solution helped me very much.

Best Regrads,
Yoga

 

Posts:3
Registered: 7/31/04
Re: How to check user input?  
Jul 31, 2004 9:07 PM (reply 4 of 4)



 
I think I should scan all of chars in the string. It's because I should check the input with 2 numeric for the first two chars and 1 char for last char from the user input.

Anyway, thank you very much for replying my message.

Regrads,
Yoga
 
This topic has 4 replies on 1 page.