(String str)
| 86 | |
| 87 | // Returns the array of runes in the specified Java UTF-16 string. |
| 88 | static int[] stringToRunes(String str) { |
| 89 | int charlen = str.length(); |
| 90 | int runelen = str.codePointCount(0, charlen); |
| 91 | int[] runes = new int[runelen]; |
| 92 | int r = 0, c = 0; |
| 93 | while (c < charlen) { |
| 94 | int rune = str.codePointAt(c); |
| 95 | runes[r++] = rune; |
| 96 | c += Character.charCount(rune); |
| 97 | } |
| 98 | return runes; |
| 99 | } |
| 100 | |
| 101 | // Returns the Java UTF-16 string containing the single rune |r|. |
| 102 | static String runeToString(int r) { |