Returns the code point at index in the specified sequence of character units. If the unit at index is a high-surrogate unit, index + 1 is less than the length of the sequence and the unit at index + 1 is a low-surrogate unit, then the supplementary code point represen
(CharSequence seq, int index)
| 2176 | * @since 1.5 |
| 2177 | */ |
| 2178 | public static int codePointAt(CharSequence seq, int index) { |
| 2179 | if (seq == null) { |
| 2180 | throw new NullPointerException(); |
| 2181 | } |
| 2182 | int len = seq.length(); |
| 2183 | if (index < 0 || index >= len) { |
| 2184 | throw new StringIndexOutOfBoundsException(index); |
| 2185 | } |
| 2186 | |
| 2187 | char high = seq.charAt(index++); |
| 2188 | if (index >= len) { |
| 2189 | return high; |
| 2190 | } |
| 2191 | char low = seq.charAt(index); |
| 2192 | if (isSurrogatePair(high, low)) { |
| 2193 | return toCodePoint(high, low); |
| 2194 | } |
| 2195 | return high; |
| 2196 | } |
| 2197 | |
| 2198 | /** |
| 2199 | * Returns the code point at {@code index} in the specified array of |
no test coverage detected