Package org.apache.commons.lang.text
Class StrMatcher.StringMatcher
java.lang.Object
org.apache.commons.lang.text.StrMatcher
org.apache.commons.lang.text.StrMatcher.StringMatcher
- 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.lang.text.StrMatcher
StrMatcher.CharMatcher, StrMatcher.CharSetMatcher, StrMatcher.NoMatcher, StrMatcher.StringMatcher, StrMatcher.TrimMatcher -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final char[]The string to match, as a character array. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintisMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) Returns whether or not the given text matches the stored string.Methods inherited from class org.apache.commons.lang.text.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
StringMatcher(String str) 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 whether or not the given text matches the stored string.- Specified by:
isMatchin 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, zero for no match
-