Package org.apache.commons.text
Class StrMatcher.CharSetMatcher
java.lang.Object
org.apache.commons.text.StrMatcher
org.apache.commons.text.StrMatcher.CharSetMatcher
- Enclosing class:
StrMatcher
Class used to define a set of characters for matching purposes.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.text.StrMatcher
StrMatcher.CharMatcher, StrMatcher.CharSetMatcher, StrMatcher.NoMatcher, StrMatcher.StringMatcher, StrMatcher.TrimMatcher
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCharSetMatcher
(char[] chars) Constructor that creates a matcher from a character array. -
Method Summary
Modifier and TypeMethodDescriptionint
isMatch
(char[] buffer, int pos, int bufferStart, int bufferEnd) Returns1
if there is a match, or0
if there is no match.Methods inherited from class org.apache.commons.text.StrMatcher
charMatcher, charSetMatcher, charSetMatcher, commaMatcher, doubleQuoteMatcher, isMatch, noneMatcher, quoteMatcher, singleQuoteMatcher, spaceMatcher, splitMatcher, stringMatcher, tabMatcher, trimMatcher
-
Field Details
-
chars
private final char[] charsThe set of characters to match.
-
-
Constructor Details
-
CharSetMatcher
CharSetMatcher(char[] chars) Constructor that creates a matcher from a character array.- Parameters:
chars
- the characters to match, must not be null
-
-
Method Details
-
isMatch
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) Returns1
if there is a match, or0
if there is no match.- Specified by:
isMatch
in classStrMatcher
- Parameters:
buffer
- the text content to match against, do not changepos
- the starting position for the match, valid for bufferbufferStart
- the first active index in the buffer, valid for bufferbufferEnd
- the end index of the active buffer, valid for buffer- Returns:
- The number of matching characters, or zero if there is no match
-