Class CharMatcher.Is

    • Field Detail

      • match

        private final char match
    • Constructor Detail

      • Is

        Is​(char match)
    • Method Detail

      • 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 class CharMatcher
      • replaceFrom

        public java.lang.String replaceFrom​(java.lang.CharSequence sequence,
                                            char replacement)
        Description copied from class: CharMatcher
        Returns a string copy of the input character sequence, with each character that matches this matcher replaced by a given replacement character. For example:
           
        
           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.

        Overrides:
        replaceFrom in class CharMatcher
        Parameters:
        sequence - the character sequence to replace matching characters in
        replacement - the character to append to the result string in place of each matching character in sequence
        Returns:
        the new string
      • toString

        public java.lang.String toString()
        Description copied from class: CharMatcher
        Returns a string representation of this CharMatcher, such as CharMatcher.or(WHITESPACE, JAVA_DIGIT).
        Overrides:
        toString in class CharMatcher