I am trying to use isDigit() to verify if a character in a string is not a digit.
if (aString.charAt(i).isDigit == false)
I am getting the error: cannot invoke isDigit on the primitive type character. What am I doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s a static method in the
Characterclass, so you need:(Note the use of
!instead of comparing the result withfalse, btw. Both ways will work, but I view the above as more idiomatic.)