Java StringBuffer codePointAt() Example

Java StringBuffer codePointAt()  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.

Java StringBuffer codePointAt() Example

public class CodePointAtExample {
 public static void main(String[] args) {
  StringBuffer buffer = new StringBuffer("javaguides");
  int unicode = buffer.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