Package org.apache.commons.text.matcher
Class StringMatcherFactory
java.lang.Object
org.apache.commons.text.matcher.StringMatcherFactory
Provides access to matchers defined in this package.
- Since:
- 1.3
-
Field Summary
Modifier and TypeFieldDescriptionstatic final StringMatcherFactory
Defines the singleton for this class. -
Method Summary
Modifier and TypeMethodDescriptionandMatcher
(StringMatcher... stringMatchers) Creates a matcher that matches all of the given matchers in order.charMatcher
(char ch) Constructor that creates a matcher from a character.charSetMatcher
(char... chars) Constructor that creates a matcher from a set of characters.charSetMatcher
(String chars) Creates a matcher from a string representing a set of characters.Returns a matcher which matches the comma character.Returns a matcher which matches the double quote character.Matches no characters.Returns a matcher which matches the single or double quote character.Returns a matcher which matches the single quote character.Returns a matcher which matches the space character.Matches the same characters as StringTokenizer, namely space, tab, newline and form feed.stringMatcher
(char... chars) Creates a matcher from a string.stringMatcher
(String str) Creates a matcher from a string.Returns a matcher which matches the tab character.Matches the String trim() whitespace characters.
-
Field Details
-
INSTANCE
Defines the singleton for this class.
-
-
Method Details
-
andMatcher
Creates a matcher that matches all of the given matchers in order.- Parameters:
stringMatchers
- the matcher- Returns:
- a matcher that matches all of the given matchers in order.
- Since:
- 1.9
-
charMatcher
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
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
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
Returns a matcher which matches the comma character.- Returns:
- a matcher for a comma
-
doubleQuoteMatcher
Returns a matcher which matches the double quote character.- Returns:
- a matcher for a double quote
-
noneMatcher
Matches no characters.- Returns:
- a matcher that matches nothing
-
quoteMatcher
Returns a matcher which matches the single or double quote character.- Returns:
- a matcher for a single or double quote
-
singleQuoteMatcher
Returns a matcher which matches the single quote character.- Returns:
- a matcher for a single quote
-
spaceMatcher
Returns a matcher which matches the space character.- Returns:
- a matcher for a space
-
splitMatcher
Matches the same characters as StringTokenizer, namely space, tab, newline and form feed.- Returns:
- The split matcher
-
stringMatcher
Creates a matcher from a string.- Parameters:
chars
- the string to match, null or empty matches nothing- Returns:
- a new Matcher for the given String
- Since:
- 1.9
-
stringMatcher
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
Returns a matcher which matches the tab character.- Returns:
- a matcher for a tab
-
trimMatcher
Matches the String trim() whitespace characters.- Returns:
- The trim matcher
-