string.codePointAt()
string.codePointAt() Returns the unicode value of the character present at the input position of the string.
Syntax
string.codePointAt(input)
input is an integer staring from 0 ( first position )
Here are some examples with output.
String my_str="Welcome to plus2net";
System.out.println(my_str.codePointAt(0)); // 87
System.out.println(my_str.codePointAt(3)); // 99
System.out.println(my_str.codePointAt(15)); // 50
Learn more about unicode values of the Chars here
What is the unicode vlaue of last char of the string ? Unicode vlaue of t is 116.
String my_str="Welcome to plus2net";
System.out.println(my_str.charAt(my_str.length()-1)); // t
System.out.println(my_str.codePointAt(my_str.length()-1)); // 116
System.out.println(my_str.codePointBefore(my_str.length())); // 116
« All String functions
This article is written by plus2net.com team.
plus2net.com