merge_whitespace

Function merge_whitespace 

Source
pub fn merge_whitespace(input: &str) -> Cow<'_, str>
Expand description

Remove multiple consecutive whitespaces from a given string and replace them with a single space. If special handling of quoted text is required, see merge_whitespace_with_quotes instead.

§Example

let output = merge_whitespace("Hello     World!\r\n      \"How        are\"         you?");
assert_eq!(output, r#"Hello World! "How are" you?"#);

§Return

The modified string.