pub fn trim_collapse_ascii_whitespace(s: &str) -> String
Expand description
Removes ASCII whitespace from before and after a string, and collapses runs of ASCII whitespaces by replacing them with a single U+0020 SPACE codepoint.
See also: WHATWG Infra Standard definition
ยงExamples
use whatwg_infra::trim_collapse_ascii_whitespace;
let s = "\r \n cat dog hamster";
assert_eq!(trim_collapse_ascii_whitespace(s), String::from("cat dog hamster"));