string.rs
1 /// Remove all whitespace ([https://www.unicode.org/reports/tr44/#White_Space]) from the string and replace with a single space. 2 pub fn adjust_whitespaces(s: &str) -> String { 3 s.split_whitespace().collect::<Vec<&str>>().join(" ") 4 } 5 6 /// Remove all whitespace ([<https://www.unicode.org/reports/tr44/#White_Space>]) from the string. 7 pub fn remove_whitespace(s: &str) -> String { 8 s.chars().filter(|c| !c.is_whitespace()).collect() 9 }