Class StringUtils

java.lang.Object
me.confuser.banmanager.common.util.StringUtils

public class StringUtils extends Object
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • join

      public static String join(Object[] array, String separator, int startIndex, int endIndex)

      Joins the elements of the provided array into a single String containing the provided list of elements.

      No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.

       StringUtils.join(null, *)               = null
       StringUtils.join([], *)                 = ""
       StringUtils.join([null], *)             = ""
       StringUtils.join(["a", "b", "c"], ';')  = "a;b;c"
       StringUtils.join(["a", "b", "c"], null) = "abc"
       StringUtils.join([null, "", "a"], ';')  = ";;a"
       
      Parameters:
      array - the array of values to join together, may be null
      separator - the separator character to use
      startIndex - the first index to start joining from. It is an error to pass in a start index past the end of the array
      endIndex - the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array
      Returns:
      the joined String, null if null array input
    • substringsBetween

      public static String[] substringsBetween(String str, String open, String close)

      Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array.

      A null input String returns null. A null open/close returns null (no match). An empty ("") open/close returns null (no match).

       StringUtils.substringsBetween("[a][b][c]", "[", "]") = ["a","b","c"]
       StringUtils.substringsBetween(null, *, *)            = null
       StringUtils.substringsBetween(*, null, *)            = null
       StringUtils.substringsBetween(*, *, null)            = null
       StringUtils.substringsBetween("", "[", "]")          = []
       
      Parameters:
      str - the String containing the substrings, null returns null, empty returns empty
      open - the String identifying the start of the substring, empty returns null
      close - the String identifying the end of the substring, empty returns null
      Returns:
      a String Array of substrings, or null if no match
    • isValidPlayerName

      public static boolean isValidPlayerName(String name, String additionalChars)