Package one.tranic.t.base.parse.html
Class HTMLParser
java.lang.Object
one.tranic.t.base.parse.html.HTMLParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull StringCleans the provided input string by removing HTML tags, normalizing line breaks, replacing consecutive spaces with a single space, and trimming leading and trailing whitespace.static StringdecodeAndStripHtml(String base64EncodedString) Decodes a Base64 encoded string and removes any HTML tags from the decoded output.static StringescapeHtml(String input) Escapes special HTML characters in a given string.static StringunescapeHtml(String escapedString) Unescapes special HTML characters in a given string.
-
Constructor Details
-
HTMLParser
public HTMLParser()
-
-
Method Details
-
decodeAndStripHtml
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
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
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
Unescapes special HTML characters in a given string.- Parameters:
escapedString- the string with escaped HTML characters- Returns:
- the unescaped raw string
-