Java StringBuilder codePointAt(int index) method returns the character (Unicode code point) at the specified index. The index refers to char values (Unicode code units) and ranges from 0 to length()- 1.
This method throws the IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.
public class CodePointAtExample {
public static void main(String[] args) {
StringBuilder builder = new StringBuilder("javaguides");
int unicode = builder.codePointAt(0);
System.out.println("the character (Unicode code point) at the specified index is :: " + unicode);
}
}
Output;
the character (Unicode code point) at the specified index is :: 106
Comments
Post a Comment