Returns the codepoint offsets for Unicode tokens. @param token token @return codepoint offsets, or null if the token is ASCII only
(final byte[] token)
| 276 | * @return codepoint offsets, or {@code null} if the token is ASCII only |
| 277 | */ |
| 278 | public static int[] cpOffsets(final byte[] token) { |
| 279 | if(ascii(token)) return null; |
| 280 | |
| 281 | final int tl = token.length; |
| 282 | final IntList list = new IntList(tl); |
| 283 | for(int t = 0; t < tl; t += cl(token, t)) list.add(t); |
| 284 | return list.finish(); |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Converts a character to a token. |