Package org.apache.commons.text.matcher
Class StringMatcherFactory
- java.lang.Object
-
- org.apache.commons.text.matcher.StringMatcherFactory
-
public final class StringMatcherFactory extends Object
Provides access to matchers defined in this package.- Since:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field Description static StringMatcherFactoryINSTANCEDefines the singleton for this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringMatchercharMatcher(char ch)Constructor that creates a matcher from a character.StringMatchercharSetMatcher(char... chars)Constructor that creates a matcher from a set of characters.StringMatchercharSetMatcher(String chars)Creates a matcher from a string representing a set of characters.StringMatchercommaMatcher()Returns a matcher which matches the comma character.StringMatcherdoubleQuoteMatcher()Returns a matcher which matches the double quote character.StringMatchernoneMatcher()Matches no characters.StringMatcherquoteMatcher()Returns a matcher which matches the single or double quote character.StringMatchersingleQuoteMatcher()Returns a matcher which matches the single quote character.StringMatcherspaceMatcher()Returns a matcher which matches the space character.StringMatchersplitMatcher()Matches the same characters as StringTokenizer, namely space, tab, newline and form feed.StringMatcherstringMatcher(String str)Creates a matcher from a string.StringMatchertabMatcher()Returns a matcher which matches the tab character.StringMatchertrimMatcher()Matches the String trim() whitespace characters.
-
-
-
Field Detail
-
INSTANCE
public static final StringMatcherFactory INSTANCE
Defines the singleton for this class.
-
-
Method Detail
-
charMatcher
public StringMatcher charMatcher(char ch)
Constructor that creates a matcher from a character.- Parameters:
ch- the character to match, must not be null- Returns:
- a new Matcher for the given char
-
charSetMatcher
public StringMatcher charSetMatcher(char... chars)
Constructor that creates a matcher from a set of characters.- Parameters:
chars- the characters to match, null or empty matches nothing- Returns:
- a new matcher for the given char[]
-
charSetMatcher
public StringMatcher charSetMatcher(String chars)
Creates a matcher from a string representing a set of characters.- Parameters:
chars- the characters to match, null or empty matches nothing- Returns:
- a new Matcher for the given characters
-
commaMatcher
public StringMatcher commaMatcher()
Returns a matcher which matches the comma character.- Returns:
- a matcher for a comma
-
doubleQuoteMatcher
public StringMatcher doubleQuoteMatcher()
Returns a matcher which matches the double quote character.- Returns:
- a matcher for a double quote
-
noneMatcher
public StringMatcher noneMatcher()
Matches no characters.- Returns:
- a matcher that matches nothing
-
quoteMatcher
public StringMatcher quoteMatcher()
Returns a matcher which matches the single or double quote character.- Returns:
- a matcher for a single or double quote
-
singleQuoteMatcher
public StringMatcher singleQuoteMatcher()
Returns a matcher which matches the single quote character.- Returns:
- a matcher for a single quote
-
spaceMatcher
public StringMatcher spaceMatcher()
Returns a matcher which matches the space character.- Returns:
- a matcher for a space
-
splitMatcher
public StringMatcher splitMatcher()
Matches the same characters as StringTokenizer, namely space, tab, newline and form feed.- Returns:
- the split matcher
-
stringMatcher
public StringMatcher stringMatcher(String str)
Creates a matcher from a string.- Parameters:
str- the string to match, null or empty matches nothing- Returns:
- a new Matcher for the given String
-
tabMatcher
public StringMatcher tabMatcher()
Returns a matcher which matches the tab character.- Returns:
- a matcher for a tab
-
trimMatcher
public StringMatcher trimMatcher()
Matches the String trim() whitespace characters.- Returns:
- the trim matcher
-
-