+ 1
how to check the a character is alphabet or a numeric?
3 Answers
+ 5
using Character api class
like
char a = 'x'
Character.isLetter() // return true
Character.isDigit() // return false (true if it is a number)
Character.isLetterOrDigit() // return true
upvote if you learned something <3
+ 2
You can aproch this multiple ways. I dont know if there is a char funktion for this. but what will work is if((int) x >= 48 && (int) x <=58) is numeric
else not
this os converting them in to ascii numbers.
You can also test if its a 1 2 3 4 5 6 7 8 9 0.
+ 1
sorry. .
(enter your character her)
ex. char a = 'x';
Character.isLetter(a)