In Java, Character.isTitleCase(ch) returns true when the character's general category is TITLECASE_LETTER. Titlecase is a third case, besides upper and lower, used by a few digraph letters: one character that looks like two letters.
For example, Unicode has single characters for the Croatian digraph "DZ with caron": uppercase U+01C4, lowercase U+01C6, and the titlecase U+01C5, which shows a capital D followed by a small z with caron. Titlecase is what you want at the start of a capitalised word. Ordinary letters such as 'A' are uppercase, not titlecase.
A static method of java.lang.Character (Java 1.0+): call it on the class, as in Character.isTitleCase(...); you do not need a Character object. No import is needed, because java.lang is always available. The int codePoint overload was added in Java 5.
Unicode version.
The answer comes from the Unicode Character Database built into your JDK, and each Java release follows a specific Unicode version (Java 8, for example, uses Unicode 6.2). The characters used on this page have had the same properties for many Unicode versions, so the examples print the same result on any current JDK.
Syntax
Pass a char or an int code point.
Java
Character.isTitleCase('\u01C5'); // true, the titlecase digraph
Character.isTitleCase('\u01C4'); // false, it is uppercase
Character.isTitleCase('A'); // false, A is uppercase
Character.isTitleCase('a'); // false
Call
What it does
Character.isTitleCase(c)
Test one character.
Character.isTitleCase(Character.toTitleCase(c))
Did the conversion produce a real titlecase letter?
Overloads: isTitleCase(char ch) and isTitleCase(int codePoint). Only a few dozen characters are titlecase: four Latin digraphs (U+01C5, U+01C8, U+01CB, U+01F2) and a group of Greek letters with a built-in iota.
Library declarations
Java
// java.lang.Character
public static boolean isTitleCase(char ch)
public static boolean isTitleCase(int codePoint) // since Java 5
Parameters
Parameter
Description
ch (char)
The character to test.
codePoint (int)
The Unicode code point to test.
Return Value
Return Value
Description
true
The category is TITLECASE_LETTER.
false
Any other character, including every ASCII letter.
Converts to the titlecase form (or uppercase when none exists).
Java Examples
Example 1 — Find the Titlecase Letters in the Latin Range
Scan U+0000 to U+024F, the Basic Latin to Latin Extended-B blocks, and print every titlecase code point.
Java
public class CharacterIsTitleCaseScan {
public static void main(String[] args) {
StringBuilder found = new StringBuilder();
int count = 0;
for (char c = 0; c <= 0x024F; c++) {
if (Character.isTitleCase(c)) {
found.append(' ').append((int) c);
count++;
}
}
System.out.println(count + " titlecase letters:" + found);
}
}
Output
4 titlecase letters: 453 456 459 498
How It Works
A char loop.c is a char counting from 0 to 0x024F (591); the upper limit is far below 0xFFFF, so the loop cannot overflow.
Only four hits. U+01C5, U+01C8, U+01CB, and U+01F2 (453, 456, 459, 498) are the titlecase forms of the digraphs DZ with caron, LJ, NJ, and DZ.
Print codes, not glyphs. Appending (int) c keeps the output plain ASCII.
Example 2 — Upper, Title, and Lower Forms of One Digraph
Test U+01C4, U+01C5, and U+01C6 with all three case methods.
Java
public class CharacterIsTitleCaseForms {
public static void main(String[] args) {
char[] forms = {'\u01C4', '\u01C5', '\u01C6'};
for (char c : forms) {
System.out.println((int) c + " upper=" + Character.isUpperCase(c)
+ " title=" + Character.isTitleCase(c)
+ " lower=" + Character.isLowerCase(c));
}
}
}
Exactly one true per row. Each of the three characters belongs to exactly one case category.
The middle form. U+01C5 (453) shows a capital D with a small z with caron; it is the only one for which isTitleCase is true.
Neighbouring code points. Unicode stores the upper, title, and lower forms next to each other, which is why the codes are 452, 453, and 454.
Example 3 — Capitalise a Word: toTitleCase vs toUpperCase
For a word starting with the lowercase digraph U+01C6, titlecase and uppercase give different first characters.
Java
public class CharacterIsTitleCaseCapitalize {
public static void main(String[] args) {
String word = "\u01C6ungla";
char first = word.charAt(0);
char title = Character.toTitleCase(first);
char upper = Character.toUpperCase(first);
System.out.println("title=" + (int) title + " isTitleCase=" + Character.isTitleCase(title));
System.out.println("upper=" + (int) upper + " isTitleCase=" + Character.isTitleCase(upper));
System.out.println("for 'a': " + Character.toTitleCase('a') + " isTitleCase=" + Character.isTitleCase(Character.toTitleCase('a')));
}
}
Output
title=453 isTitleCase=true
upper=452 isTitleCase=false
for 'a': A isTitleCase=false
How It Works
The right way to capitalise.toTitleCase turns U+01C6 into U+01C5 (453), a capital D with a small z, which is how the start of a capitalised word should look.
Uppercase is too much.toUpperCase gives U+01C4 (452), with both parts capitalised, like writing "DZungla".
Ordinary letters.'a' has no titlecase form, so toTitleCase returns the uppercase A, and isTitleCase('A') is still false.
Frequently Asked Questions
A letter used at the start of a capitalised word when the letter is a digraph, such as U+01C5. It has a capital first part and a small second part.
No. A is UPPERCASE_LETTER. Ordinary letters have no separate titlecase form, so isTitleCase returns false for them.
Only a few dozen: four Latin digraphs and a set of Greek capital letters with a built-in iota. Everything else returns false.
No. Words usually start with an ordinary uppercase letter, which is not titlecase. Check isUpperCase on the first letter instead.
Mostly when capitalising words in a fully Unicode-aware way: use toTitleCase rather than toUpperCase for the first character.