Function htmlize::escape_all_quotes
source · pub fn escape_all_quotes<'a, S: Into<Cow<'a, str>>>(input: S) -> Cow<'a, str>
Expand description
Escape a string including both single and double quotes.
Generally, it is safe to leave single quotes (apostrophes) unescaped, so you
should use escape_text()
or escape_attribute()
.
use htmlize::escape_all_quotes;
assert_eq!(
escape_all_quotes(r#"Björk & Борис O'Brien <3, "love > hate""#),
"Björk & Борис O'Brien <3, "love > hate""
);
To work with bytes ([u8]
) instead of strings, see
escape_all_quotes_bytes()
.