Java Data Type Tutorial - Java Character.toTitleCase(int codePoint)








Syntax

Character.toTitleCase(int codePoint) has the following syntax.

public static int toTitleCase(int codePoint)

Example

In the following code shows how to use Character.toTitleCase(int codePoint) method.

public class Main {
/*from  w w  w.  j  a  v  a 2 s .c  o  m*/
  public static void main(String[] args) {
    int cp1 = 0x0068; 
    int cp2 = 0x005c; 

    int cp3 = Character.toTitleCase(cp1);
    int cp4 = Character.toTitleCase(cp2);

    String str1 = "Titlecase equivalent of " + cp1 + " is " + cp3;
    String str2 = "Titlecase equivalent of " + cp2 + " is " + cp4;

    System.out.println(str1);
    System.out.println(str2);
  }
}

The code above generates the following result.