How do you check if a one-character String is a letter – including any letters with accents?
I had to work this out recently, so I’ll answer it myself, after the recent VB6 question reminded me.
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.
Just checking if a letter is in A-Z because that doesn’t include letters with accents or letters in other alphabets.
I found out that you can use the regular expression class for ‘Unicode letter’, or one of its case-sensitive variations:
You can also do this with Character class:
but that is less convenient if you need to check more than one letter.