How can I determine if String contains only alphabets and I want to have little more than [a-zA-Z]+, so is there any way to determine alphabets by Locale?
Share
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.
The
Characterclass has methods such asisLetterwhich will be able to determine if a character is a letter as defined in the API specification for the method.There is also another approach of using the
Character.UnicodeBlockclass which is able to return whether a character is in a specific character block of Unicode.For example, I had to determine whether a character was a full-width katakana character, and to be able to do so, I had to use the
Character.UnicodeBlock.ofmethod:Also to add, the character at a certain index of a
Stringcan be retrieved by using thecharAt(int)method, and the Unicode code point can be retrieved by thecodePointAt(int)method.