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