java.lang.Character isTitleCase(int codePoint)
Description
A character is a titlecase character if its general category type, provided by getType(codePoint), is 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.
These are some of the Unicode characters for which this method returns true:
- LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
- LATIN CAPITAL LETTER L WITH SMALL LETTER J
- LATIN CAPITAL LETTER N WITH SMALL LETTER J
- LATIN CAPITAL LETTER D WITH SMALL LETTER Z
Many other Unicode characters are titlecase too.
The isTitleCase(int codePoint) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:
Character.isTitleCase(int codePoint)
Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java isTitleCase() method non statically.
Method Syntax
public static boolean isTitleCase(int codePoint)
Method Argument
Data Type | Parameter | Description |
---|---|---|
int | codePoint | the character (Unicode code point) to be tested. |
Method Returns
The isTitleCase(int codePoint) method of Character class returns true if the character is titlecase; false otherwise.
Compatibility
Requires Java 1.5 and up
Java Character isTitleCase(int codePoint) Example
Below is a simple java example on the usage of isTitleCase(int codePoint) method of Character class.
package com.javatutorialhq.java.examples; /* * This example source code demonstrates the use of * isTitleCase(int codePoint) method of Character class. */ public class CharacterIsTitleCaseCodepointExample { public static void main(String[] args) { // initialize a char int codepoint = 88; // convert codepoint to char char ch = (char)codepoint; // check if the codepoint is title case or not boolean checkBool = Character.isTitleCase(codepoint); // print result if(checkBool){ System.out.print("Value '"+ch+"' is Title case"); } else{ System.out.print("Value '"+ch+"' is not Title case"); } } }
Sample Output
Below is the sample output when you run the above example.