/** * Returns a {@code char} matcher that matches any character in a given range (both endpoints are * inclusive). For example, to match any lowercase letter of the English alphabet, use {@code * CharMatcher.inRange('a', 'z')}. * * @throws IllegalArgumentException if {@code endInclusive < startInclusive} */ public static CharMatcher inRange(final char startInclusive, final char endInclusive) { checkArgument(endInclusive >= startInclusive); String description = "CharMatcher.inRange('" + showCharacter(startInclusive) + "', '" + showCharacter(endInclusive) + "')"; return inRange(startInclusive, endInclusive, description); }
/** * Returns a {@code char} matcher that matches any character in a given range (both endpoints are * inclusive). For example, to match any lowercase letter of the English alphabet, use {@code * CharMatcher.inRange('a', 'z')}. * * @throws IllegalArgumentException if {@code endInclusive < startInclusive} */ public static CharMatcher inRange(final char startInclusive, final char endInclusive) { checkArgument(endInclusive >= startInclusive); String description = "CharMatcher.inRange('" + showCharacter(startInclusive) + "', '" + showCharacter(endInclusive) + "')"; return inRange(startInclusive, endInclusive, description); }
/** * Returns a {@code char} matcher that matches any character in a given range (both endpoints are * inclusive). For example, to match any lowercase letter of the English alphabet, use {@code * CharMatcher.inRange('a', 'z')}. * * @throws IllegalArgumentException if {@code endInclusive < startInclusive} */ public static CharMatcher inRange(final char startInclusive, final char endInclusive) { checkArgument(endInclusive >= startInclusive); String description = "CharMatcher.inRange('" + showCharacter(startInclusive) + "', '" + showCharacter(endInclusive) + "')"; return inRange(startInclusive, endInclusive, description); }
/** * Returns a {@code char} matcher that matches any character in a given range (both endpoints are * inclusive). For example, to match any lowercase letter of the English alphabet, use {@code * CharMatcher.inRange('a', 'z')}. * * @throws IllegalArgumentException if {@code endInclusive < startInclusive} */ public static CharMatcher inRange(final char startInclusive, final char endInclusive) { checkArgument(endInclusive >= startInclusive); String description = "CharMatcher.inRange('" + showCharacter(startInclusive) + "', '" + showCharacter(endInclusive) + "')"; return inRange(startInclusive, endInclusive, description); }
/** * Returns a {@code char} matcher that matches only one specified character. */ public static CharMatcher is(final char match) { String description = "CharMatcher.is('" + showCharacter(match) + "')"; return new FastMatcher(description) { @Override public boolean matches(char c) { return c == match; } @Override public String replaceFrom(CharSequence sequence, char replacement) { return sequence.toString().replace(match, replacement); } @Override public CharMatcher and(CharMatcher other) { return other.matches(match) ? this : NONE; } @Override public CharMatcher or(CharMatcher other) { return other.matches(match) ? other : super.or(other); } @Override public CharMatcher negate() { return isNot(match); } @GwtIncompatible("java.util.BitSet") @Override void setBits(BitSet table) { table.set(match); } }; }
/** * Returns a {@code char} matcher that matches only one specified character. */ public static CharMatcher is(final char match) { String description = "CharMatcher.is('" + showCharacter(match) + "')"; return new FastMatcher(description) { @Override public boolean matches(char c) { return c == match; } @Override public String replaceFrom(CharSequence sequence, char replacement) { return sequence.toString().replace(match, replacement); } @Override public CharMatcher and(CharMatcher other) { return other.matches(match) ? this : NONE; } @Override public CharMatcher or(CharMatcher other) { return other.matches(match) ? other : super.or(other); } @Override public CharMatcher negate() { return isNot(match); } @GwtIncompatible("java.util.BitSet") @Override void setBits(BitSet table) { table.set(match); } }; }
/** * Returns a {@code char} matcher that matches only one specified character. */ public static CharMatcher is(final char match) { String description = "CharMatcher.is('" + showCharacter(match) + "')"; return new FastMatcher(description) { @Override public boolean matches(char c) { return c == match; } @Override public String replaceFrom(CharSequence sequence, char replacement) { return sequence.toString().replace(match, replacement); } @Override public CharMatcher and(CharMatcher other) { return other.matches(match) ? this : NONE; } @Override public CharMatcher or(CharMatcher other) { return other.matches(match) ? other : super.or(other); } @Override public CharMatcher negate() { return isNot(match); } @GwtIncompatible("java.util.BitSet") @Override void setBits(BitSet table) { table.set(match); } }; }
/** * Returns a {@code char} matcher that matches only one specified character. */ public static CharMatcher is(final char match) { String description = "CharMatcher.is('" + showCharacter(match) + "')"; return new FastMatcher(description) { @Override public boolean matches(char c) { return c == match; } @Override public String replaceFrom(CharSequence sequence, char replacement) { return sequence.toString().replace(match, replacement); } @Override public CharMatcher and(CharMatcher other) { return other.matches(match) ? this : NONE; } @Override public CharMatcher or(CharMatcher other) { return other.matches(match) ? other : super.or(other); } @Override public CharMatcher negate() { return isNot(match); } @GwtIncompatible("java.util.BitSet") @Override void setBits(BitSet table) { table.set(match); } }; }