nushell/crates/nu-parser/src/deparse.rs

15 lines
307 B
Rust
Raw Normal View History

pub fn escape_quote_string(input: &str) -> String {
let mut output = String::with_capacity(input.len() + 2);
output.push('"');
for c in input.chars() {
if c == '"' || c == '\\' {
output.push('\\');
}
output.push(c);
}
output.push('"');
output
}