Class StringHelper

java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.StringHelper

public class StringHelper extends Object
Static helper class for functions in relation to Strings
  • Constructor Details

    • StringHelper

      public StringHelper()
  • Method Details

    • findValuesAfterKeyBeforeSpace

      public static String[] findValuesAfterKeyBeforeSpace(String text, String key)
      Gets all the text after the and before the next space in the Will return null if the key is not found For example: 'species:1 type1:fire type2:dark' {'1:fire', '2:dark'}
      Parameters:
      text - The text to search through
      key - The key being searched for
      Returns:
      The text after the key before the next space
    • stripSpecialCharacters

      public static String stripSpecialCharacters(String in)
    • toID

      public static String toID(String in)
    • getFormattedDuration

      public static net.minecraft.network.chat.MutableComponent getFormattedDuration(long timeMillis)
    • getFormattedDuration

      public static net.minecraft.network.chat.MutableComponent getFormattedDuration(long timeMillis, boolean fullOutWritten)
    • capitalizeString

      public static String capitalizeString(String str)
    • capitalizeAllWords

      public static String capitalizeAllWords(String str)
      Capitalizes the first letter and every letter that appears after a space.
      Parameters:
      str - the string to have every word capitalized
      Returns:
      the given string with the first letter of each word capitalized
    • buildStringForConsecutiveNumbers

      public static String buildStringForConsecutiveNumbers(List<Integer> listOfNumbers)
      Builds a string to list consecutive numbers simpler.

      Builds a string where a range of consecutive numbers has the inner numbers replaced with a dash and the outer numbers (the min and max of the range) shown. If numbers are not consecutive, they are listed with a comma and space between the next number range.

      Parameters:
      listOfNumbers - A List
      Returns:
      a string of the format "1-4, 6-7, 9-11, 13"