This documentation is archived and is not being maintained.

Character.isLetter Method

Visual Studio 2005

Checks if a specified char is a letter.

Package: java.lang

Assembly: vjslib (in vjslib.dll)


public static boolean isLetter(
    char ch);

Parameters

ch

The char to be checked.

true if the char is a letter; false otherwise.

// c-isletter1.jsl
// Character.isLetter example

public class MyClass
{
    public static void main(String[] args)
    {
        char c1 ='A';
        char c2 = '3';
        boolean b1 = Character.isLetter(c1);
        boolean b2 = Character.isLetter(c2);
        if(b1 == true)
           System.out.println(c1 + " is a letter.");
        else
           System.out.println(c1 + " is not a letter.");
        if(b2 == true)
           System.out.println(c2 + " is a letter.");
        else
           System.out.println(c2 + " is not a letter.");
    }
}

/*
Output:
A is a letter.
3 is not a letter.
*/

The character is a letter if its general category is one of the following: LOWERCASE_LETTER

UPPERCASE_LETTER

TITLECASE_LETTER

MODIFIER_LETTER

OTHER_LETTER

Show: