Class Formatter

java.lang.Object
com.marcpg.libpg.text.Formatter

public class Formatter extends Object
Used to format text.
Since:
0.0.1
  • Method Details

    • toPascalCase

      @NotNull public static @NotNull String toPascalCase(@NotNull @NotNull String in)
      Convert a string in "TEST_STRING" format to pascal case: "Test String".
      Parameters:
      in - The string that should be converted.
      Returns:
      The string but formatted to pascal case. For example, "HUMAN_LIFE" becomes "Human Life".
    • lineWrap

      public static @Unmodifiable List<String> lineWrap(String text, int maxWidth)
      Wraps a long string into multiple lines based on a max length/width per line. Will split based on words separated by spaces, to avoid splitting in the middle of a word.
      Parameters:
      text - The text that should be line wrapped.
      maxWidth - The maximum length/width per line in characters.
      Returns:
      The line-wrapped text, as a list where each value represents a line.
      Since:
      0.0.8