liltof liltof - 2 months ago 8
Android Question

Determine if character has case in JAVA

In JAVA (Android), I'm trying to determine in a String, if each character has a equivalent in upper or lower case.

My goal is not to lower or upper the case, but to know if it's possible.

For example this function would return true for : 'e' 'é' 'i' 'l' 'L' 'O' 'P'
and false for emojis or chinese characters.

Is there any function that can do this?

Answer Source

You can try this:

boolean validate(char c){
    return Character.isUpperCase(c) || Character.isLowerCase(c);
}

This will return true iff it is a Letter in uppercase or lower case only. Otherwise it'll return false.