Class StringUtil

java.lang.Object
com.seibel.distanthorizons.coreapi.util.StringUtil

public class StringUtil extends Object
Miscellaneous string helper functions.
  • Constructor Details

    • StringUtil

      public StringUtil()
  • Method Details

    • nthIndexOf

      public static int nthIndexOf(String str, String substr, int n)
      Returns the n-th index of the given string.

      Original source: https://stackoverflow.com/questions/3976616/how-to-find-nth-occurrence-of-character-in-a-string
    • join

      public static <T> String join(String delimiter, T[] list)
      See Also:
    • join

      public static <T> String join(String delimiter, Iterable<T> list)
      Combines each item in the given list together separated by the given delimiter.
    • byteArrayToHexString

      public static String byteArrayToHexString(byte[] bytes)
      Converts the given byte array into a hex string representation.
      source: https://stackoverflow.com/a/9855338