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
-
- All Implemented Interfaces:
Predicate<java.lang.Character>,java.util.function.Predicate<java.lang.Character>
- Enclosing class:
- CharMatcher
private static final class CharMatcher.Is extends CharMatcher.FastMatcher
Implementation ofCharMatcher.is(char).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.base.CharMatcher
CharMatcher.FastMatcher, CharMatcher.NamedFastMatcher, CharMatcher.NegatedFastMatcher, CharMatcher.Whitespace
-
-
Field Summary
Fields Modifier and Type Field Description private charmatch
-
Constructor Summary
Constructors Constructor Description Is(char match)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharMatcherand(CharMatcher other)Returns a matcher that matches any character matched by both this matcher andother.booleanmatches(char c)Determines a true or false value for the given character.CharMatchernegate()Returns a matcher that matches any character not matched by this matcher.CharMatcheror(CharMatcher other)Returns a matcher that matches any character matched by either this matcher orother.java.lang.StringreplaceFrom(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) voidsetBits(java.util.BitSet table)Sets bits intablematched by this matcher.java.lang.StringtoString()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
-
-
-
-
Method Detail
-
matches
public boolean matches(char c)
Description copied from class:CharMatcherDetermines a true or false value for the given character.- Specified by:
matchesin classCharMatcher
-
replaceFrom
public java.lang.String replaceFrom(java.lang.CharSequence sequence, char replacement)Description copied from class:CharMatcherReturns 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:
replaceFromin 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
public CharMatcher and(CharMatcher other)
Description copied from class:CharMatcherReturns a matcher that matches any character matched by both this matcher andother.- Overrides:
andin classCharMatcher
-
or
public CharMatcher or(CharMatcher other)
Description copied from class:CharMatcherReturns a matcher that matches any character matched by either this matcher orother.- Overrides:
orin classCharMatcher
-
negate
public CharMatcher negate()
Description copied from class:CharMatcherReturns a matcher that matches any character not matched by this matcher.- Specified by:
negatein interfacejava.util.function.Predicate<java.lang.Character>- Overrides:
negatein classCharMatcher.FastMatcher
-
setBits
@GwtIncompatible void setBits(java.util.BitSet table)
Description copied from class:CharMatcherSets bits intablematched by this matcher.- Overrides:
setBitsin classCharMatcher
-
toString
public java.lang.String toString()
Description copied from class:CharMatcherReturns a string representation of thisCharMatcher, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT).- Overrides:
toStringin classCharMatcher
-
-