Monday, December 8, 2025
HomeLanguagesJavaCharacter.isTitleCase() in Java with examples

Character.isTitleCase() in Java with examples

The java.lang.Character.isTitleCase() in an inbuilt method in java which determines if the specified character is a titlecase character or not. A character is a titlecase character if its general category type, provided by getType(codePoint), is a TITLECASE_LETTER.
Some characters look like pairs of Latin letters. For example, there is an uppercase letter that looks like “LJ” and has a corresponding lowercase letter that looks like “lj”. A third form, which looks like “Lj”, is the appropriate form to use when rendering a word in lowercase with initial capitals, as for a book title.

Given below are some of the Unicode characters for which this method returns true:

  1. LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
  2. LATIN CAPITAL LETTER L WITH SMALL LETTER J
  3. LATIN CAPITAL LETTER N WITH SMALL LETTER J
  4. LATIN CAPITAL LETTER D WITH SMALL LETTER Z

Syntax:

public static boolean isTitleCase(char ch)

Parameter:The function accepts only one mandatory parameter ch which signifies the character to be tested.

Return Value: This method returns true if the character is titlecase else it returns false.

Below program illustrate the isTitleCase() method:




// Java program to demonstrate
// Character.isTitleCase() method
import java.lang.*;
public class gfg {
  
    public static void main(String[] args)
    {
  
        // Assign values to ch1, ch2
        char ch1 = 'Z';
        char ch2 = '\u01f2';
  
        // Function to check if the
        // character is a title case or not
        boolean b1 = Character.isTitleCase(ch1);
        boolean b2 = Character.isTitleCase(ch2);
  
        System.out.println(ch1 + " is a titlecase character is " + b1);
        System.out.println("unicode \u01f2 is a titlecase character is " + b2);
    }
}


Output:

Z is a titlecase character is false
unicode ? is a titlecase character is true
RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32429 POSTS0 COMMENTS
Milvus
103 POSTS0 COMMENTS
Nango Kala
6803 POSTS0 COMMENTS
Nicole Veronica
11945 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12015 POSTS0 COMMENTS
Shaida Kate Naidoo
6934 POSTS0 COMMENTS
Ted Musemwa
7189 POSTS0 COMMENTS
Thapelo Manthata
6883 POSTS0 COMMENTS
Umr Jansen
6869 POSTS0 COMMENTS