public
synchronized int codePointAt(int index)
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.
public class StringBufferCodePointAt { public static void main(String args[]){ int arr[] = {65536, 65537, 65538}; String s = new String(arr, 0, arr.length); StringBuffer str = new StringBuffer(s); for(int i=0; i<str.length(); i++){ System.out.print("Code point at index " + i +" is "); System.out.println(str.codePointAt(i)); } } }
Output
Code point at index 0 is 65536 Code point at index 1 is 56320 Code point at index 2 is 65537 Code point at index 3 is 56321 Code point at index 4 is 65538 Code point at index 5 is 56322
No comments:
Post a Comment