merge_whitespace_with_quotes

Function merge_whitespace_with_quotes 

Source
pub fn merge_whitespace_with_quotes(
    input: &str,
    quote_char: Option<char>,
    escape_char: Option<char>,
) -> Cow<'_, str>
Expand description

Remove multiple consecutive whitespaces from a given string literal and replace them with a single space. Quoted text will be ignored and kept as-is.

§Example

let output = merge_whitespace_with_quotes("Hello     World!\r\n      \"How        are\"         you?", Some('"'), None);
assert_eq!(output, "Hello World! \"How        are\" you?");

§Return

The modified string.