Class StringUtil

java.lang.Object
org.bukkit.util.StringUtil

public class StringUtil extends Object
  • Constructor Details

    • StringUtil

      public StringUtil()
  • Method Details

    • copyPartialMatches

      @NotNull public static <T extends Collection<? super String>> T copyPartialMatches(@NotNull String token, @NotNull Iterable<String> originals, @NotNull T collection) throws UnsupportedOperationException, IllegalArgumentException
      Copies all elements from the iterable collection of originals to the collection provided.
      Type Parameters:
      T - the collection of strings
      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
      Throws:
      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
    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase(@NotNull String string, @NotNull String prefix) throws IllegalArgumentException, NullPointerException
      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
      Throws:
      NullPointerException - if prefix is null
      IllegalArgumentException - if string is null