- Java.lang Package classes
- Java.lang - Home
- Java.lang - Boolean
- Java.lang - Byte
- Java.lang - Character
- Java.lang - Character.Subset
- Java.lang - Character.UnicodeBlock
- Java.lang - Class
- Java.lang - ClassLoader
- Java.lang - Compiler
- Java.lang - Double
- Java.lang - Enum
- Java.lang - Float
- Java.lang - InheritableThreadLocal
- Java.lang - Integer
- Java.lang - Long
- Java.lang - Math
- Java.lang - Number
- Java.lang - Object
- Java.lang - Package
- Java.lang - Process
- Java.lang - ProcessBuilder
- Java.lang - Runtime
- Java.lang - RuntimePermission
- Java.lang - SecurityManager
- Java.lang - Short
- Java.lang - StackTraceElement
- Java.lang - StrictMath
- Java.lang - String
- Java.lang - StringBuffer
- Java.lang - StringBuilder
- Java.lang - System
- Java.lang - Thread
- Java.lang - ThreadGroup
- Java.lang - ThreadLocal
- Java.lang - Throwable
- Java.lang - Void
- Java.lang Package extras
- Java.lang - Interfaces
- Java.lang - Errors
- Java.lang - Exceptions
- Java.lang Package Useful Resources
- Java.lang - Useful Resources
- Java.lang - Discussion
Java.lang.Character.toTitleCase() Method
Description
The java.lang.Character.toTitleCase(int codePoint) converts the character (Unicode code point) argument to titlecase using case mapping information from the UnicodeData file.
If a character has no explicit titlecase mapping and is not itself a titlecase char according to UnicodeData, then the uppercase mapping is returned as an equivalent titlecase mapping. If the character argument is already a titlecase character, the same character value will be returned.
Note that Character.isTitleCase(Character.toTitleCase(codePoint)) does not always return true for some ranges of characters.
Declaration
Following is the declaration for java.lang.Character.toTitleCase() method
public static int toTitleCase(int codePoint)
Parameters
codePoint − the character (Unicode code point) to be converted
Return Value
This method returns the titlecase equivalent of the character, if any; otherwise, the character itself.
Exception
NA
Example
The following example shows the usage of lang.Character.toTitleCase() method.
package com.tutorialspoint; import java.lang.*; public class CharacterDemo { public static void main(String[] args) { // create 4 int primitives int cp1, cp2, cp3, cp4; // assign values to cp1, cp2 cp1 = 0x0067; // represents g cp2 = 0x005e; // represents ^ // assign titlecase of cp1, cp2 to cp3, cp4 cp3 = Character.toTitleCase(cp1); cp4 = Character.toTitleCase(cp2); String str1 = "Titlecase equivalent of " + cp1 + " is " + cp3; String str2 = "Titlecase equivalent of " + cp2 + " is " + cp4; // print cp3, cp4 values System.out.println( str1 ); System.out.println( str2 ); } }
Let us compile and run the above program, this will produce the following result −
Titlecase equivalent of 103 is 71 Titlecase equivalent of 94 is 94