Class StringUtil

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

public class StringUtil
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    StringUtil()  
  • Method Summary

    Modifier and Type Method Description
    static <T extends java.util.Collection<? super java.lang.String>>
    T
    copyPartialMatches​(java.lang.String token, java.lang.Iterable<java.lang.String> originals, T collection)
    Copies all elements from the iterable collection of originals to the collection provided.
    static boolean startsWithIgnoreCase​(java.lang.String string, java.lang.String prefix)
    This method uses a region to check case-insensitive equality.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • copyPartialMatches

      public static <T extends java.util.Collection<? super java.lang.String>> T copyPartialMatches​(java.lang.String token, java.lang.Iterable<java.lang.String> originals, T collection) throws java.lang.UnsupportedOperationException, java.lang.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:
      java.lang.UnsupportedOperationException - if the collection is immutable and originals contains a string which starts with the specified search string.
      java.lang.IllegalArgumentException - if any parameter is is null
      java.lang.IllegalArgumentException - if originals contains a null element. Note: the collection may be modified before this is thrown
    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase​(java.lang.String string, java.lang.String prefix) throws java.lang.IllegalArgumentException, java.lang.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:
      java.lang.NullPointerException - if prefix is null
      java.lang.IllegalArgumentException - if string is null