You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2b-rs/bot-coreutils/src/string.rs

6 lines
174 B
Rust

/// Enquotes a string in a safe way
pub fn enquote<S: ToString>(value: S) -> String {
let value = value.to_string();
format!("\"{}\"", value.replace("\"", "\\\""))
}