Methods in the Character Class
Method | Description |
---|---|
isDigit(ch) | Returns true if the specified character is a digit. |
isLetter(ch) | Returns true if the specified character is a letter. |
isLetterOfDigit(ch) | Returns true if the specified character is a letter or digit. |
isLowerCase(ch) | Returns true if the specified character is a lowercase letter. |
isUpperCase(ch) | Returns true if the specified character is an uppercase letter. |
toLowerCase(ch) | Returns the lowercase of the specified character. |
toUpperCase(ch) | Returns the uppercase of the specified character. |
For example,
public class Main { public static void main(String[] argv) throws Exception { System.out.println("isDigit('a') is " + Character.isDigit('a')); System.out.println("isLetter('a') is " + Character.isLetter('a')); System.out.println("isLowerCase('a') is " + Character.isLowerCase('a')); System.out.println("isUpperCase('a') is " + Character.isUpperCase('a')); System.out.println("toLowerCase('T') is " + Character.toLowerCase('T')); System.out.println("toUpperCase('q') is " + Character.toUpperCase('q')); }/* ww w .j a va2 s . c om*/ }