private int indexOfSupplementary(int c, int start) { if (!Character.isSupplementaryCodePoint(c)) { return -1; } char[] chars = Character.toChars(c); String needle = new String(0, chars.length, chars); return indexOf(needle, start); }
private int lastIndexOfSupplementary(int c, int start) { if (!Character.isSupplementaryCodePoint(c)) { return -1; } char[] chars = Character.toChars(c); String needle = new String(0, chars.length, chars); return lastIndexOf(needle, start); }
break; index += Character.isSupplementaryCodePoint(cp) ? 2 : 1;
/** * Converts the specified Unicode code point into a UTF-16 encoded sequence * and returns it as a char array. * * @param codePoint * the Unicode code point to encode. * @return the UTF-16 encoded char sequence. If {@code codePoint} is a * {@link #isSupplementaryCodePoint(int) supplementary code point}, * then the returned array contains two characters, otherwise it * contains just one character. * @throws IllegalArgumentException if {@code codePoint} is not a valid code point. * @since 1.5 */ public static char[] toChars(int codePoint) { checkValidCodePoint(codePoint); if (isSupplementaryCodePoint(codePoint)) { int cpPrime = codePoint - 0x10000; int high = 0xD800 | ((cpPrime >> 10) & 0x3FF); int low = 0xDC00 | (cpPrime & 0x3FF); return new char[] { (char) high, (char) low }; } return new char[] { (char) codePoint }; }
break; index += Character.isSupplementaryCodePoint(cp) ? 2 : 1;
if (isSupplementaryCodePoint(codePoint)) { if (dstIndex == dst.length - 1) { throw new IndexOutOfBoundsException();
int nextIndex = index + (Character.isSupplementaryCodePoint(cp) ? 2 : 1); if (escaped != null) { int charsSkipped = index - unescapedChunkStart;
break; index += Character.isSupplementaryCodePoint(cp) ? 2 : 1;
break; index += Character.isSupplementaryCodePoint(cp) ? 2 : 1;
if (!mayContainSupplCodepoints && Character.isSupplementaryCodePoint(ch)) { mayContainSupplCodepoints = true;
unescapedChunkStart = index + (Character.isSupplementaryCodePoint(cp) ? 2 : 1); index = nextEscapeIndex(s, unescapedChunkStart, end);
reader.forward(); c = reader.peek(); if (!Character.isSupplementaryCodePoint(c) && ESCAPE_REPLACEMENTS.containsKey(Character.valueOf((char)c))) { } else if (!Character.isSupplementaryCodePoint(c) && ESCAPE_CODES.containsKey(Character.valueOf((char)c))) {
break; index += Character.isSupplementaryCodePoint(cp) ? 2 : 1;
int nextIndex = index + (Character.isSupplementaryCodePoint(cp) ? 2 : 1); if (escaped != null) { int charsSkipped = index - unescapedChunkStart;
index += (Character.isSupplementaryCodePoint(cp) ? 2 : 1); unescapedChunkStart = index;
int codePoint = Integer.parseInt(currentEscapedCode, 16); check(Character.isValidCodePoint(codePoint), "Invalid escaped character: " + currentEscapedCode, context); if (Character.isSupplementaryCodePoint(codePoint)) { unicodeStringBuilder.appendCodePoint(codePoint);
int nextIndex = index + (Character.isSupplementaryCodePoint(cp) ? 2 : 1); if (escaped != null) { int charsSkipped = index - unescapedChunkStart;
break; index += Character.isSupplementaryCodePoint(cp) ? 2 : 1;
int ch = lexemes.next(); if (Character.isSupplementaryCodePoint(ch)) { substring.append(Character.toChars(ch)); } else {
private TAbstractSet processCharSet(int ch) { boolean isSupplCodePoint = Character.isSupplementaryCodePoint(ch); if (hasFlag(TPattern.CASE_INSENSITIVE)) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { return new TCICharSet((char) ch); } else if (hasFlag(TPattern.UNICODE_CASE) && ch > 128) { if (isSupplCodePoint) { return new TUCISupplCharSet(ch); } else if (TLexer.isLowSurrogate(ch)) { // we need no UCILowSurrogateCharSet return new TLowSurrogateCharSet((char) ch); } else if (TLexer.isHighSurrogate(ch)) { // we need no UCIHighSurrogateCharSet return new THighSurrogateCharSet((char) ch); } else { return new TUCICharSet((char) ch); } } } if (isSupplCodePoint) { return new TSupplCharSet(ch); } else if (TLexer.isLowSurrogate(ch)) { return new TLowSurrogateCharSet((char) ch); } else if (TLexer.isHighSurrogate(ch)) { return new THighSurrogateCharSet((char) ch); } else { return new TCharSet((char) ch); } }