Skip to main content

strip_quotes

Function strip_quotes 

Source
pub fn strip_quotes<'a>(
    input: &'a str,
) -> Result<QuoteStripped<'a>, UnclosedQuotesError<'a>>
Expand description

Strip quotes from an input, given that both quotes use either " or ', but not both.

ยงExample

assert_eq!(
    strip_quotes("\"Helvetica\""),
    Ok(QuoteStripped("Helvetica"))
);
assert_eq!(strip_quotes("'Arial'"), Ok(QuoteStripped("Arial")));
assert_eq!(
    strip_quotes("\"Arial'"),
    Err(UnclosedQuotesError("\"Arial'"))
);