dequote

Macro dequote 

Source
macro_rules! dequote {
    ($str:expr) => { ... };
}
Expand description

Removes surrounding double quotes from a string.

This macro takes an expression that evaluates to a string and returns a new String with any leading or trailing double quotes removed. It’s useful for cleaning up string data that might be inadvertently wrapped in quotes, such as JSON string values.

§Arguments

  • $str: An expression that can be converted into a string slice (&str).

§Examples

use your_crate::dequote; // Assuming `dequote` is re-exported or in scope

let quoted_string = "\"hello world\"";
let dequoted_string = dequote!(quoted_string);
assert_eq!(dequoted_string, "hello world");

let already_clean = "no quotes";
let dequoted_clean = dequote!(already_clean);
assert_eq!(dequoted_clean, "no quotes");