int length = str.codePointCount(0, str.length());. You can also use a Stream of codepoints, as of Java 8: int length = str.codePoints().count();.
確定! 回上一頁