strip_comments_in_place

Function strip_comments_in_place 

Source
pub fn strip_comments_in_place(s: &mut str) -> Result<()>
Expand description

Strips comments from a string in place, replacing it with whitespaces.

/// ## Example

use json_strip_comments::strip_comments_in_place;

let mut string = String::from(r#"{
// c line comment
"a": "comment in string /* a */"
# shell line comment
} /** end */"#);

strip_comments_in_place(&mut string).unwrap();

assert_eq!(string, "{
                 \n\"a\": \"comment in string /* a */\"
                    \n}           ");