Class StringMgmt

java.lang.Object
com.palmergames.util.StringMgmt

public class StringMgmt extends Object
Useful functions related to strings, or arrays of them.
Version:
1.4
Author:
Shade (Chris H)
  • Field Details

    • hexPattern

      public static final Pattern hexPattern
    • hexReplacePattern

      public static final Pattern hexReplacePattern
  • Constructor Details

    • StringMgmt

      public StringMgmt()
  • Method Details

    • translateHexColors

      public static String translateHexColors(String string)
    • translateHexColors

      @Internal public static String translateHexColors(String string, Function<String,String> hexFunction)
    • join

      public static String join(Collection<?> args)
    • join

      public static String join(Collection<?> args, String separator)
    • join

      public static String join(Object[] arr)
    • join

      public static String join(Object[] arr, String separator)
    • join

      public static String join(Map<?,?> map, String keyValSeparator, String tokenSeparator)
    • repeat

      public static String repeat(String sequence, int repetitions)
    • remFirstArg

      public static String[] remFirstArg(String[] arr)
    • remLastArg

      public static String[] remLastArg(String[] arr)
    • remArgs

      public static String[] remArgs(String[] arr, int startFromIndex)
    • subArray

      public static String[] subArray(String[] arr, int start, int end)
    • trimMaxLength

      public static String trimMaxLength(String str, int length)
      Shortens the string to fit in the specified size.
      Parameters:
      str - - String to trim
      length - - length to trim to
      Returns:
      the shortened string
    • maxLength

      public static String maxLength(String str, int length)
      Shortens the string to fit in the specified size with an ellipse "..." at the end.
      Parameters:
      str - - String to fit
      length - - Length of the string, before shortening
      Returns:
      the shortened string, followed with ellipses
    • containsIgnoreCase

      public static boolean containsIgnoreCase(List<String> arr, String str)
    • remUnderscore

      public static String remUnderscore(String str)
      Replaces underscores with spaces.
      Parameters:
      str - - the string to change.
      Returns:
      the string with spaces replacing underscores.
    • capitalize

      public static String capitalize(String str)
    • capitalizeStrings

      public static String capitalizeStrings(String string)
      Capitalizes the beginning of each word, accounting for underscores separating those words
      Parameters:
      string - String to capitalize.
      Returns:
      String with the beginning letter of each word capitalized.
    • parseOnOff

      public static boolean parseOnOff(String s) throws Exception
      Throws:
      Exception
    • isAllUpperCase

      public static boolean isAllUpperCase(@NotNull @NotNull String string)
    • isAllUpperCase

      public static boolean isAllUpperCase(@NotNull @NotNull Collection<String> collection)
    • addToList

      public static List<String> addToList(List<String> list, String addition)
    • wrap

      public static String wrap(String string, int wrapLength, String newlineString)