pub fn collapse(s: &str) -> String
Expand description
Trim leading and trailing whitespace and collapse all consecutive whitespace to a single space character
use collapse::collapse;
assert_eq!(collapse("two spaces"), "two spaces");
assert_eq!(collapse("new\r\nlines"), "new lines");
assert_eq!(collapse("\t lead\t tail \r"), "lead tail");