trim_quotes

Function trim_quotes 

Source
pub fn trim_quotes(s: &str) -> (String, bool)
Expand description

Remove surrounding double quotes from a string. Handles escape sequences within the quoted string.

Returns (unquoted_string, success). If the string is not properly quoted, returns the original and false.

ยงExamples

use backend_test::backend::trimquotes::trim_quotes;

let (s, ok) = trim_quotes(r#""hello world""#);
assert_eq!(s, "hello world");
assert!(ok);

let (s, ok) = trim_quotes("unquoted");
assert_eq!(s, "unquoted");
assert!(!ok);