Enum Class FormatUtil

java.lang.Object
java.lang.Enum<FormatUtil>
dk.lockfuglsang.minecraft.util.FormatUtil
All Implemented Interfaces:
Serializable, Comparable<FormatUtil>, Constable

public enum FormatUtil extends Enum<FormatUtil>
Format utility
  • Method Details

    • values

      public static FormatUtil[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FormatUtil valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • stripFormatting

      public static String stripFormatting(String format)
    • normalize

      public static String normalize(String format)
    • wordWrap

      public static List<String> wordWrap(String s, int lineSize)
    • wordWrap

      public static List<String> wordWrap(String s, int firstSegment, int lineSize)
      Wraps the string rather lazyly around the linesize (over). I.e.
         this is a line of words
       
      Will break into the following with linesize of 11:
         this is a line
         of words
       
      Note that the first line is longer than 11 (14).
    • wordWrapStrict

      public static List<String> wordWrapStrict(String s, int lineLength)
    • join

      public static String join(List<String> list, String separator)
    • prefix

      public static List<String> prefix(List<String> list, String prefix)
    • camelcase

      public static String camelcase(String name)
    • escape

      public static String escape(String formatString)
      Escapes formatting by "denormalizing" back to using & instead of §.
      Parameters:
      formatString - A formatstring (formerly normalized).
      Returns:
      A non-format string using & instead of §.
      Since:
      1.10