pub fn unescape_html(s: &str) -> Cow<'_, str>Expand description
Decodes the HTML entities &, <, >, ", ', ' and any numeric
character reference (A, A).
It is the inverse of escape_html. The text is decoded in a single
pass, so &lt; becomes < and not <. Anything that is not a known entity, including
a numeric reference that is not a valid character, is left as it is. Returns the input
borrowed, without allocating, when it contains no &.
§Arguments
s- The text to decode.
§Examples
use helpers4::string::unescape_html;
assert_eq!(unescape_html("<b>Tom & Jerry</b>"), "<b>Tom & Jerry</b>");
assert_eq!(unescape_html("AB"), "AB");
assert_eq!(unescape_html("&lt;"), "<");
assert_eq!(unescape_html("&unknown;"), "&unknown;");