public class Wildcard extends Object
High-performance, low-fragmentation wildcard matching. Provides a left-to-right wildcard matching pattern, where - `?` means any one char - `*` means any number of char - `?*` means at least one char - `**` is treated as `*` - `*?` is treated as `?*`. Note that matching is by char, not by byte
| Constructor and Description |
|---|
Wildcard() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull String[] |
compile(CharSequence str)
Split into arrays by `*`.
|
static int |
index(boolean igc,
@NotNull CharSequence str,
int off,
@NotNull String ptn)
match the index from offset at the beginning, -1 means not found.
|
static int |
index(boolean igc,
@NotNull CharSequence str,
@NotNull String ptn)
match the index from the beginning, -1 means not found.
|
static int |
index(@NotNull CharSequence str,
@NotNull String ptn)
Case-insensitive match the index from the beginning, -1 means not found.
|
static boolean |
match(boolean igc,
CharSequence str,
String... ptn)
null does not match any character, but matches if all null are present.
|
@NotNull public static @NotNull String[] compile(CharSequence str)
Split into arrays by `*`. `**` treated as `*`, `*?` treated as `?*` `*.doc` = [`*`,`.doc`] `abc?.doc` = [`abc?.doc`] `**.doc` = [`*`,`.doc`] `??*.doc` = [`??`,`*`,`.doc`] `**?**.doc` = [`?`,`*`,`.doc`]
public static boolean match(boolean igc,
CharSequence str,
String... ptn)
igc - whether ignore case (case-insensitive)str - string to match, skip nullptn - patterns (should from `compile`), null or empty don't matchpublic static int index(@NotNull
@NotNull CharSequence str,
@NotNull
@NotNull String ptn)
public static int index(boolean igc,
@NotNull
@NotNull CharSequence str,
@NotNull
@NotNull String ptn)
public static int index(boolean igc,
@NotNull
@NotNull CharSequence str,
int off,
@NotNull
@NotNull String ptn)
igc - whether ignore case (case-insensitive)str - string to matchoff - the offset to match fromptn - the pattern to matchCopyright © 2023. All rights reserved.