private static final class CharMatcher.Is extends CharMatcher.FastMatcher
CharMatcher.is(char)
.CharMatcher.FastMatcher, CharMatcher.NamedFastMatcher, CharMatcher.NegatedFastMatcher, CharMatcher.Whitespace
Modifier and Type | Field and Description |
---|---|
private char |
match |
Constructor and Description |
---|
Is(char match) |
Modifier and Type | Method and Description |
---|---|
CharMatcher |
and(CharMatcher other)
Returns a matcher that matches any character matched by both this matcher and
other . |
boolean |
matches(char c)
Determines a true or false value for the given character.
|
CharMatcher |
negate()
Returns a matcher that matches any character not matched by this matcher.
|
CharMatcher |
or(CharMatcher other)
Returns a matcher that matches any character matched by either this matcher or
other . |
java.lang.String |
replaceFrom(java.lang.CharSequence sequence,
char replacement)
Returns a string copy of the input character sequence, with each matching BMP character
replaced by a given replacement character.
|
(package private) void |
setBits(java.util.BitSet table)
Sets bits in
table matched by this matcher. |
java.lang.String |
toString()
Returns a string representation of this
CharMatcher , such as CharMatcher.or(WHITESPACE, JAVA_DIGIT) . |
precomputed
any, anyOf, apply, ascii, breakingWhitespace, collapseFrom, countIn, digit, forPredicate, indexIn, indexIn, inRange, invisible, is, isNot, javaDigit, javaIsoControl, javaLetter, javaLetterOrDigit, javaLowerCase, javaUpperCase, lastIndexIn, matchesAllOf, matchesAnyOf, matchesNoneOf, none, noneOf, precomputedInternal, removeFrom, replaceFrom, retainFrom, singleWidth, trimAndCollapseFrom, trimFrom, trimLeadingFrom, trimTrailingFrom, whitespace
public boolean matches(char c)
CharMatcher
matches
in class CharMatcher
public java.lang.String replaceFrom(java.lang.CharSequence sequence, char replacement)
CharMatcher
CharMatcher.is('a').replaceFrom("radar", 'o')
... returns "rodor"
.
The default implementation uses CharMatcher.indexIn(CharSequence)
to find the first matching
character, then iterates the remainder of the sequence calling CharMatcher.matches(char)
for each
character.
replaceFrom
in class CharMatcher
sequence
- the character sequence to replace matching characters inreplacement
- the character to append to the result string in place of each matching
character in sequence
public CharMatcher and(CharMatcher other)
CharMatcher
other
.and
in class CharMatcher
public CharMatcher or(CharMatcher other)
CharMatcher
other
.or
in class CharMatcher
public CharMatcher negate()
CharMatcher
negate
in interface java.util.function.Predicate<java.lang.Character>
negate
in class CharMatcher.FastMatcher
@GwtIncompatible void setBits(java.util.BitSet table)
CharMatcher
table
matched by this matcher.setBits
in class CharMatcher
public java.lang.String toString()
CharMatcher
CharMatcher
, such as CharMatcher.or(WHITESPACE, JAVA_DIGIT)
.toString
in class CharMatcher