Home >>Java String Methods >Java String codePointAt() Method

Java String codePointAt() Method

Java String codePointAt() Method

The codePointAt() method in Java String is used to returns the character's unicode value in a string at the specified index(first character is 0, the second character is 1, and so on).

Syntax

public int codePointAt(int index)

Parameter

index - It is used to representing An int value in the index of the character to return

Returns

It is representing an int value to the Unicode value of the character at the index

Throws

IndexOutOfBoundsException- Where index is negative, or not less than the specified string length

Java String codePointAt() method example 1

public class MyClass 
{
  public static void main(String[] args) 
  {
    String name = " phptpoint";
    int result = name.codePointAt(0);
    System.out.println(result);
  }
}

32

No Sidebar ads