Package com.google.common.base
Class CharMatcher.Is
java.lang.Object
com.google.common.base.CharMatcher
com.google.common.base.CharMatcher.FastMatcher
com.google.common.base.CharMatcher.Is
- Enclosing class:
CharMatcher
Implementation of
CharMatcher.is(char)
.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.base.CharMatcher
CharMatcher.FastMatcher, CharMatcher.NamedFastMatcher, CharMatcher.Whitespace
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionand
(CharMatcher other) Returns a matcher that matches any character matched by both this matcher andother
.boolean
matches
(char c) Determines a true or false value for the given character.negate()
Returns a matcher that matches any character not matched by this matcher.or
(CharMatcher other) Returns a matcher that matches any character matched by either this matcher orother
.replaceFrom
(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
Sets bits intable
matched by this matcher.toString()
Returns a string representation of thisCharMatcher
, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT)
.Methods inherited from class com.google.common.base.CharMatcher.FastMatcher
precomputed
Methods inherited from class com.google.common.base.CharMatcher
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
-
Field Details
-
match
private final char match
-
-
Constructor Details
-
Is
Is(char match)
-
-
Method Details
-
matches
public boolean matches(char c) Description copied from class:CharMatcher
Determines a true or false value for the given character.- Specified by:
matches
in classCharMatcher
-
replaceFrom
Description copied from class:CharMatcher
Returns a string copy of the input character sequence, with each matching BMP character replaced by a given replacement character. For example:
... returnsCharMatcher.is('a').replaceFrom("radar", 'o')
"rodor"
.The default implementation uses
CharMatcher.indexIn(CharSequence)
to find the first matching character, then iterates the remainder of the sequence callingCharMatcher.matches(char)
for each character.- Overrides:
replaceFrom
in classCharMatcher
- Parameters:
sequence
- the character sequence to replace matching characters inreplacement
- the character to append to the result string in place of each matching character insequence
- Returns:
- the new string
-
and
Description copied from class:CharMatcher
Returns a matcher that matches any character matched by both this matcher andother
.- Overrides:
and
in classCharMatcher
-
or
Description copied from class:CharMatcher
Returns a matcher that matches any character matched by either this matcher orother
.- Overrides:
or
in classCharMatcher
-
negate
Description copied from class:CharMatcher
Returns a matcher that matches any character not matched by this matcher.- Specified by:
negate
in interfacePredicate<Character>
- Overrides:
negate
in classCharMatcher.FastMatcher
-
setBits
Description copied from class:CharMatcher
Sets bits intable
matched by this matcher.- Overrides:
setBits
in classCharMatcher
-
toString
Description copied from class:CharMatcher
Returns a string representation of thisCharMatcher
, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT)
.- Overrides:
toString
in classCharMatcher
-