java.lang.Character toTitleCase(int codePoint)
Description
Note that Character.isTitleCase(Character.toTitleCase(codePoint)) does not always return true for some ranges of characters.
The toTitleCase(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.toTitleCase(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 toTitleCase() method non statically.
Method Syntax
public static int toTitleCase(int codePoint)
Method Argument
Data Type | Parameter | Description |
---|---|---|
int | codepoint | the character (Unicode code point) to be converted. |
Method Returns
The toTitleCase(int codePoint) method of Character class returns the titlecase equivalent of the character, if any; otherwise, the character itself.
Compatibility
Requires Java 1.5 and up
Java Character toTitleCase(int codePoint) Example
Below is a simple java example on the usage of toTitleCase(int codePoint) method of Character class.
package com.javatutorialhq.java.examples; /* * This example source code demonstrates the use of * toTitleCase(int codePoint) method of Character class. */ public class CharacterToTitleCaseCodePointExample { public static void main(String[] args) { // initialize a char int codepoint = 102; // convert codepoint to char char ch = (char) codepoint; // convert the code point to title case char chTitleCase = Character.toTitleCase(ch); // print the result System.out.println("character '" + ch + "' title case is " + chTitleCase); } }
Sample Output
Below is the sample output when you run the above example.