Class HTMLParser

java.lang.Object
one.tranic.t.base.parse.html.HTMLParser

public class HTMLParser extends Object
  • Constructor Details

    • HTMLParser

      public HTMLParser()
  • Method Details

    • decodeAndStripHtml

      public static String decodeAndStripHtml(String base64EncodedString)
      Decodes a Base64 encoded string and removes any HTML tags from the decoded output.

      Also trims leading whitespace from the resulting string.

      Parameters:
      base64EncodedString - the Base64 encoded string containing potential HTML content
      Returns:
      the decoded string with HTML tags removed and leading whitespace trimmed
    • escapeHtml

      public static String escapeHtml(String input)
      Escapes special HTML characters in a given string.
      Parameters:
      input - the raw string to be escaped
      Returns:
      the escaped string suitable for HTML content
    • clean

      @NotNull public static @NotNull String clean(@NotNull @NotNull String input)
      Cleans the provided input string by removing HTML tags, normalizing line breaks, replacing consecutive spaces with a single space, and trimming leading and trailing whitespace.
      Parameters:
      input - the input string to be cleaned; must not be null or blank
      Returns:
      the cleaned string with HTML tags removed, normalized line breaks, trimmed whitespace, and reduced consecutive spaces
    • unescapeHtml

      public static String unescapeHtml(String escapedString)
      Unescapes special HTML characters in a given string.
      Parameters:
      escapedString - the string with escaped HTML characters
      Returns:
      the unescaped raw string