/** * Return the total number of codepoints in the buffer. Each surrogate pair counts as a single codepoint */ public static int length(CharSequence c) { return length(CodepointIterator.forCharSequence(c)); }
private boolean isNextSurrogate() { if (!hasNext()) return false; char c = get(position()); return CharUtils.isHighSurrogate(c) || CharUtils.isLowSurrogate(c); }
/** * Verifies a sequence of codepoints using the specified profile */ public static void verify(char[] s, Profile profile) throws InvalidCharacterException { if (s == null) return; verify(CodepointIterator.forCharArray(s), profile); }
/** * Verifies a sequence of codepoints using the specified profile */ public static void verify(String s, Profile profile) throws InvalidCharacterException { if (s == null) return; verify(CodepointIterator.forCharSequence(s), profile); }
/** * Create a codepoint from a surrogate pair */ public Codepoint(char high, char low) { this(CharUtils.toSupplementary(high, low).getValue()); }
/** * Return the total number of codepoints in the buffer. Each surrogate pair counts as a single codepoint */ public static int length(char[] c) { return length(CodepointIterator.forCharArray(c)); }
/** * True if isAlpha and isDigit both return true */ public static boolean isAlphaDigit(Codepoint codepoint) { return isAlphaDigit(codepoint.getValue()); }
private Codepoint toCodepoint(char[] chars) { return (chars == null) ? null : (chars.length == 1) ? new Codepoint(chars[0]) : CharUtils .toSupplementary(chars[0], chars[1]); }
/** * Verifies a sequence of codepoints using the specified profile */ public static void verifyNot(char[] array, Profile profile) throws InvalidCharacterException { CodepointIterator rci = CodepointIterator.forCharArray(array).restrict(profile.filter(), false, true); while (rci.hasNext()) rci.next(); }