|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectclassycle.util.WildCardPattern
public class WildCardPattern
Wildcard string pattern matching class. Only '*' is interpreted as wild card meaning the occurance of any number of arbitray characters.
This is a thread-safe immutable class.
Example: The code snippet
StringPattern pattern = new WildCardPattern("Hello*"); System.out.println(pattern.matches("Hello world!")); System.out.println(pattern.matches("Hi Jim!"));will produce the output
true false
Constructor Summary | |
---|---|
WildCardPattern(java.lang.String pattern)
Creates an instance based on the specified pattern. |
Method Summary | |
---|---|
static StringPattern |
createFromsPatterns(java.lang.String patterns,
java.lang.String delimiters)
Returns a StringPattern object based on a sequences of
wild-card patterns separated by the specified delimiter characters. |
boolean |
matches(java.lang.String string)
Returns true if the specified string matches the pattern. |
java.lang.String |
toString()
Returns the pattern as delivered to the constructor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WildCardPattern(java.lang.String pattern)
pattern
- Pattern which may contain '*' wildcard characters.
Must be not null.Method Detail |
---|
public static StringPattern createFromsPatterns(java.lang.String patterns, java.lang.String delimiters)
StringPattern
object based on a sequences of
wild-card patterns separated by the specified delimiter characters.
The return object matches a string if at least one of the
wild-card pattern matches.
patterns
- Wild-card patterns separated by delimiters defined
in delimiters. The actual pattern will be trimed.
That is, leading and trailing white-space characters are removed.delimiters
- Recognized delimiters.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean matches(java.lang.String string)
StringPattern
matches
in interface StringPattern
string
- String to be matched. Can be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |