[][src]Function lazy_transform_str::escape_double_quotes

#[must_use = "pure function"]pub fn escape_double_quotes(string: &str) -> Cow<'_, String, str>

Replaces \ and " in string with (repectively) \\ and \", as lazily as possible.

Example

use cervine::Cow;
use lazy_transform_str::escape_double_quotes;

let input = r#"a "quoted" word"#;

let output = escape_double_quotes(input);

assert_eq!(output, Cow::Owned(r#"a \"quoted\" word"#.into()));