Check whether the character is ASCII 7 bit alphabetic upper case in Java
Description
The following code shows how to check whether the character is ASCII 7 bit alphabetic upper case.
Example
/*w w w. jav a 2 s. c o m*/
public class Main {
public static boolean isAsciiAlphaUpper(char ch) {
return ch >= 'A' && ch <= 'Z';
}
public static void main(String[] argv) {
System.out.println(isAsciiAlphaUpper('a'));
System.out.println(isAsciiAlphaUpper('A'));
System.out.println(isAsciiAlphaUpper('3'));
System.out.println(isAsciiAlphaUpper('-'));
System.out.println(isAsciiAlphaUpper('\n'));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »