Class StrMatcher.StringMatcher
java.lang.Object
org.apache.commons.text.StrMatcher
org.apache.commons.text.StrMatcher.StringMatcher
- Enclosing class:
StrMatcher
Class used to define a set of characters for matching purposes.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final char[]The string to match, as a character array. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStringMatcher(String str) Constructor that creates a matcher from a String. -
Method Summary
Methods inherited from class StrMatcher
charMatcher, charSetMatcher, charSetMatcher, commaMatcher, doubleQuoteMatcher, isMatch, noneMatcher, quoteMatcher, singleQuoteMatcher, spaceMatcher, splitMatcher, stringMatcher, tabMatcher, trimMatcher
-
Field Details
-
chars
private final char[] charsThe string to match, as a character array.
-
-
Constructor Details
-
StringMatcher
Constructor that creates a matcher from a String.- Parameters:
str- the string to match, must not be null
-
-
Method Details
-
isMatch
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) Returns the number of matching characters, or zero if there is no match.- Specified by:
isMatchin classStrMatcher- Parameters:
buffer- the text content to match against, do not change.pos- the starting position for the match, valid for buffer.bufferStart- the first active index in the buffer, valid for buffer.bufferEnd- the end index of the active buffer, valid for buffer.- Returns:
- The number of matching characters, or zero if there is no match.
-
toString
-