|
static< TextendsCollection<?superString > T | copyPartialMatches (final String token, final Iterable< String > originals, final T collection) throws UnsupportedOperationException, IllegalArgumentException |
|
static boolean | startsWithIgnoreCase (final String string, final String prefix) throws IllegalArgumentException, NullPointerException |
|
Definition at line 6 of file StringUtil.java.
static <TextendsCollection<?superString> T org.bukkit.util.StringUtil.copyPartialMatches |
( |
final String |
token, |
|
|
final Iterable< String > |
originals, |
|
|
final T |
collection |
|
) |
| throws UnsupportedOperationException, IllegalArgumentException |
|
static |
Copies all elements from the iterable collection of originals to the collection provided.
- Parameters
-
token | String to search for |
originals | An iterable collection of strings to filter. |
collection | The collection to add matches to |
- Returns
- the collection provided that would have the elements copied into
- Exceptions
-
UnsupportedOperationException | if the collection is immutable and originals contains a string which starts with the specified search string. |
IllegalArgumentException | if any parameter is is null |
IllegalArgumentException | if originals contains a null element. Note: the collection may be modified before this is thrown |
Definition at line 24 of file StringUtil.java.
References org.bukkit.util.StringUtil.startsWithIgnoreCase().
25 Validate.notNull(token,
"Search token cannot be null");
26 Validate.notNull(collection,
"Collection cannot be null");
27 Validate.notNull(originals,
"Originals cannot be null");
29 for (String
string : originals) {
31 collection.add(
string);
static boolean startsWithIgnoreCase(final String string, final String prefix)
static boolean org.bukkit.util.StringUtil.startsWithIgnoreCase |
( |
final String |
string, |
|
|
final String |
prefix |
|
) |
| throws IllegalArgumentException, NullPointerException |
|
static |
This method uses a region to check case-insensitive equality. This means the internal array does not need to be copied like a toLowerCase() call would.
- Parameters
-
string | String to check |
prefix | Prefix of string to compare |
- Returns
- true if provided string starts with, ignoring case, the prefix provided
- Exceptions
-
NullPointerException | if prefix is null |
IllegalArgumentException | if string is null |
Definition at line 50 of file StringUtil.java.
Referenced by org.bukkit.util.StringUtil.copyPartialMatches(), org.bukkit.command.Command.tabComplete(), and org.bukkit.command.SimpleCommandMap.tabComplete().
51 Validate.notNull(
string,
"Cannot check a null string for a match");
52 if (
string.length() < prefix.length()) {
55 return string.regionMatches(
true, 0, prefix, 0, prefix.length());
The documentation for this class was generated from the following file: