public class Wildcard
extends java.lang.Object
This method uses recursive matching, as in linux or windows. regexp works the same. This method is very fast, comparing to similar implementations.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
PATH_MATCH |
protected static java.lang.String |
PATH_SEPARATORS |
Constructor and Description |
---|
Wildcard() |
Modifier and Type | Method and Description |
---|---|
static boolean |
equalsOrMatch(java.lang.CharSequence string,
java.lang.CharSequence pattern)
Checks if two strings are equals or if they
match(CharSequence, CharSequence) . |
static boolean |
match(java.lang.CharSequence string,
java.lang.CharSequence pattern)
Checks whether a string matches a given wildcard pattern.
|
static int |
matchOne(java.lang.String src,
java.lang.String... patterns)
Matches string to at least one pattern.
|
static boolean |
matchPath(java.lang.String path,
java.lang.String pattern)
Matches path against pattern using *, ?
|
static int |
matchPathOne(java.lang.String path,
java.lang.String... patterns)
Matches path to at least one pattern.
|
protected static boolean |
matchTokens(java.lang.String[] tokens,
java.lang.String[] patterns)
Match tokenized string and pattern.
|
protected static final java.lang.String PATH_MATCH
protected static final java.lang.String PATH_SEPARATORS
public static boolean match(java.lang.CharSequence string, java.lang.CharSequence pattern)
string
- input stringpattern
- pattern to matchtrue
if string matches the pattern, otherwise false
public static boolean equalsOrMatch(java.lang.CharSequence string, java.lang.CharSequence pattern)
match(CharSequence, CharSequence)
.
Useful for cases when matching a lot of equal strings and speed is important.public static int matchOne(java.lang.String src, java.lang.String... patterns)
-1
otherwise.match(CharSequence, CharSequence)
public static int matchPathOne(java.lang.String path, java.lang.String... patterns)
-1
otherwise.matchPath(String, String)
public static boolean matchPath(java.lang.String path, java.lang.String pattern)
protected static boolean matchTokens(java.lang.String[] tokens, java.lang.String[] patterns)
Copyright © 2003-present Jodd Team