| java.lang.Object org.apache.commons.lang.text.StrMatcher
StrMatcher | abstract public class StrMatcher (Code) | | A matcher class that can be queried to determine if a character array
portion matches.
This class comes complete with various factory methods.
If these do not suffice, you can subclass and implement your own matcher.
author: Stephen Colebourne since: 2.2 version: $Id: StrMatcher.java 437554 2006-08-28 06:21:41Z bayard $ |
Inner Class :final static class CharSetMatcher extends StrMatcher | |
Inner Class :final static class CharMatcher extends StrMatcher | |
Inner Class :final static class StringMatcher extends StrMatcher | |
Inner Class :final static class NoMatcher extends StrMatcher | |
Inner Class :final static class TrimMatcher extends StrMatcher | |
Constructor Summary | |
protected | StrMatcher() Constructor. |
StrMatcher | protected StrMatcher()(Code) | | Constructor.
|
charMatcher | public static StrMatcher charMatcher(char ch)(Code) | | Constructor that creates a matcher from a character.
Parameters: ch - the character to match, must not be null a new Matcher for the given char |
charSetMatcher | public static StrMatcher charSetMatcher(char[] chars)(Code) | | Constructor that creates a matcher from a set of characters.
Parameters: chars - the characters to match, null or empty matches nothing a new matcher for the given char[] |
charSetMatcher | public static StrMatcher charSetMatcher(String chars)(Code) | | Constructor that creates a matcher from a string representing a set of characters.
Parameters: chars - the characters to match, null or empty matches nothing a new Matcher for the given characters |
commaMatcher | public static StrMatcher commaMatcher()(Code) | | Returns a matcher which matches the comma character.
a matcher for a comma |
doubleQuoteMatcher | public static StrMatcher doubleQuoteMatcher()(Code) | | Returns a matcher which matches the double quote character.
a matcher for a double quote |
isMatch | abstract public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd)(Code) | | Returns the number of matching characters, zero for no match.
This method is called to check for a match.
The parameter pos represents the current position to be
checked in the string buffer (a character array which must
not be changed).
The API guarantees that pos is a valid index for buffer .
The character array may be larger than the active area to be matched.
Only values in the buffer between the specifed indices may be accessed.
The matching code may check one character or many.
It may check characters preceeding pos as well as those
after, so long as no checks exceed the bounds specified.
It must return zero for no match, or a positive number if a match was found.
The number indicates the number of characters that matched.
Parameters: buffer - the text content to match against, do not change Parameters: pos - the starting position for the match, valid for buffer Parameters: bufferStart - the first active index in the buffer, valid for buffer Parameters: bufferEnd - the end index (exclusive) of the active buffer, valid for buffer the number of matching characters, zero for no match |
noneMatcher | public static StrMatcher noneMatcher()(Code) | | Matches no characters.
a matcher that matches nothing |
quoteMatcher | public static StrMatcher quoteMatcher()(Code) | | Returns a matcher which matches the single or double quote character.
a matcher for a single or double quote |
singleQuoteMatcher | public static StrMatcher singleQuoteMatcher()(Code) | | Returns a matcher which matches the single quote character.
a matcher for a single quote |
spaceMatcher | public static StrMatcher spaceMatcher()(Code) | | Returns a matcher which matches the space character.
a matcher for a space |
splitMatcher | public static StrMatcher splitMatcher()(Code) | | Matches the same characters as StringTokenizer,
namely space, tab, newline and formfeed.
the split matcher |
stringMatcher | public static StrMatcher stringMatcher(String str)(Code) | | Constructor that creates a matcher from a string.
Parameters: str - the string to match, null or empty matches nothing a new Matcher for the given String |
tabMatcher | public static StrMatcher tabMatcher()(Code) | | Returns a matcher which matches the tab character.
a matcher for a tab |
trimMatcher | public static StrMatcher trimMatcher()(Code) | | Matches the String trim() whitespace characters.
the trim matcher |
|
|