int length = "😁".length(); System.out.println("length " + length);//2
int at1 = "😁".codePointAt(0); System.out.println("at1 " + at1);//128513 int at2 = "😁".codePointAt(1); System.out.println("at2 " + at2);//56833
int before1 = "😁".codePointBefore(1); System.out.println("before1 " + before1);//55357 int before2 = "😁".codePointBefore(2); System.out.println("before2 " + before2);//128513
int count = "😁".codePointCount(0, "😁".length()-1); System.out.println("count " + count);//1
"😁".codePoints().boxed().forEach( integer -> System.out.println(integer));
int offset = "😁😁".offsetByCodePoints(1, 2); System.out.println("offset " + offset);//4
總結的時候發現仍是有些疑問的, 煩煩煩, 待續吧
java的字符編碼集
What exactly does String.codePointAt do?html