Class RichTextStringUtils

java.lang.Object
com.nomagic.text.rich.RichTextStringUtils

@OpenApiAll public class RichTextStringUtils extends Object
Utility class to work with rich text.
  • Field Details

  • Constructor Details

    • RichTextStringUtils

      public RichTextStringUtils()
  • Method Details

    • closeColor

      public static String closeColor(String text)
      Close color tag.
      Parameters:
      text - text
    • closeColor

      public static void closeColor(StringBuilder text)
      Close color tag.
      Parameters:
      text - text
    • closeColor

      public static void closeColor(StringBuffer text)
      Close color tag.
      Parameters:
      text - text
    • startColor

      public static void startColor(StringBuffer text, Color color)
      Set given color to the given text.
      Parameters:
      text - text
      color - color
    • startColor

      public static void startColor(StringBuilder text, Color color)
      Set given color to the given text.
      Parameters:
      text - text
      color - color
    • startColor

      public static String startColor(String text, Color color)
      Set given color to the given text.
      Parameters:
      text - text
      color - color
      Returns:
      text with given color
    • wrapInColor

      public static String wrapInColor(@CheckForNull String text, Color color)
      Set given color to the given text.
      Parameters:
      text - text
      color - color
      Returns:
      text with given color
    • wrapInColor

      public static void wrapInColor(StringBuilder text, Color color)
      Set given color to the given text.
      Parameters:
      text - text
      color - color
    • wrapInColor

      public static void wrapInColor(StringBuffer text, Color color)
      Set given color to the given text.
      Parameters:
      text - text
      color - color
    • trimText

      public static String trimText(String text, int endIndex)
      Trim text up to the given index. Make sure that "color" tag is not cut.
      Parameters:
      text - text
      endIndex - cut end index
      Returns:
      cut text
    • trimText

      public static String trimText(String text, int startIndex, int endIndex)
      Trim text from-to the given index. Make sure that "color" tag is not cut.
      Parameters:
      text - text
      startIndex - cut start index
      endIndex - cut end index
      Returns:
      cut text
    • toString

      public static String toString(Color color)
      Parameters:
      color - color
      Returns:
      color representation