pub fn strip_dquotes(quoted_string: &str) -> Option<&str> {
    let len = quoted_string.len();
    let bytes = quoted_string.as_bytes();
    //SLICE_SAFE: && shor circuites if len < 1 and by using bytes there is no problem with utf8
    // char boundaries
    if bytes.iter().next() == Some(&b'"') && bytes[len-1] == b'"' {
        //SLICE_SAFE: [0] and [len-1] are checked to be '"'
        Some(&quoted_string[1..len-1])
    } else {
        None
    }
}
/// strips quotes if they exists
///
/// returns None if the input does not start with `"` and ends with `"`
///
/// # Example
/// ```
/// use quoted_string::strip_dquotes;
/// assert_eq!(strip_dquotes("\"a b\""), Some("a b"));
/// assert_eq!(strip_dquotes("a b"), None);
/// assert_eq!(strip_dquotes("\"a b"), None);
/// assert_eq!(strip_dquotes("a b\""), None);
/// ```
strips quotes if they exists
returns None if the input does not start with `"` and ends with `"`
strips quotes if they exists returns None if the input does not start with ` " ` and ends with ` " `
pub fn strip_dquotes(quoted_string: &str) -> Option<&str> {
    let len = quoted_string.len();
    let bytes = quoted_string.as_bytes();
    //SLICE_SAFE: && shor circuites if len < 1 and by using bytes there is no problem with utf8
    // char boundaries
    if bytes.iter().next() == Some(&b'"') && bytes[len-1] == b'"' {
        //SLICE_SAFE: [0] and [len-1] are checked to be '"'
        Some(&quoted_string[1..len-1])
    } else {
        None
    }
}
pub fn strip_dquotes ( quoted_string : & str ) -> Option < & str > { let len = quoted_string . len ( ) ; let bytes = quoted_string . as_bytes ( ) ; //SLICE_SAFE: && shor circuites if len < 1 and by using bytes there is no problem with utf8 // char boundaries if bytes . iter ( ) . next ( ) == Some ( & b'"' ) && bytes [ len - 1 ] == b'"' { //SLICE_SAFE: [0] and [len-1] are checked to be '"' Some ( & quoted_string [ 1 .. len - 1 ] ) } else { None } }
strips quotes if they exists
returns None if the input does not start with `"` and ends with `"`
strips quotes if they exists returns None if the input does not start with ` " ` and ends with ` " `
quoted_string
&str
quoted_string
&str
example
None