pub fn unquote_slice(content: &[u8]) -> &[u8] {
    if content.len() < 2 {
        content
    } else if content.starts_with(b"<<<") {
        // The heredoc case
        // These types of strings begin with an opening line containing <<<
        // followed by a string to use as a terminator (which is optionally
        // quoted), and end with a line containing only the terminator.
        // We need to drop the opening line and terminator line.
        match (find(content, b'\n'), rfind(content, b'\n')) {
            (Some(start), Some(end)) => {
                // An empty heredoc, this way, will have start >= end
                if start >= end {
                    &[]
                } else {
                    &content[start + 1..end]
                }
            }
            _ => content,
        }
    } else {
        let c1 = content[0];
        let c2 = content[content.len() - 1];
        if c1 == c2 && (c1 == b'\'' || c1 == b'"' || c1 == b'`') {
            &content[1..content.len() - 1]
        } else {
            content
        }
    }
}
/// Remove single quotes, double quotes, backticks, or heredoc/nowdoc delimiters
/// surrounding a string literal. If the input slice is valid UTF-8, the output
/// slice will also be valid UTF-8.
Remove single quotes, double quotes, backticks, or heredoc/nowdoc delimiters
surrounding a string literal. If the input slice is valid UTF-8, the output
slice will also be valid UTF-8.
Remove single quotes double quotes backticks or heredoc / nowdoc delimiters surrounding a string literal . If the input slice is valid UTF - 8 the output slice will also be valid UTF - 8 .
pub fn unquote_slice(content: &[u8]) -> &[u8] {
    if content.len() < 2 {
        content
    } else if content.starts_with(b"<<<") {
        // The heredoc case
        // These types of strings begin with an opening line containing <<<
        // followed by a string to use as a terminator (which is optionally
        // quoted), and end with a line containing only the terminator.
        // We need to drop the opening line and terminator line.
        match (find(content, b'\n'), rfind(content, b'\n')) {
            (Some(start), Some(end)) => {
                // An empty heredoc, this way, will have start >= end
                if start >= end {
                    &[]
                } else {
                    &content[start + 1..end]
                }
            }
            _ => content,
        }
    } else {
        let c1 = content[0];
        let c2 = content[content.len() - 1];
        if c1 == c2 && (c1 == b'\'' || c1 == b'"' || c1 == b'`') {
            &content[1..content.len() - 1]
        } else {
            content
        }
    }
}
pub fn unquote_slice ( content : & [ u8 ] ) -> & [ u8 ] { if content . len ( ) < 2 { content } else if content . starts_with ( b" " ) { // The heredoc case // These types of strings begin with an opening line containing <<< // followed by a string to use as a terminator (which is optionally // quoted), and end with a line containing only the terminator. // We need to drop the opening line and terminator line. match ( find ( content , b'\n' ) , rfind ( content , b'\n' ) ) { ( Some ( start ) , Some ( end ) ) => { // An empty heredoc, this way, will have start >= end if start >= end { & [ ] } else { & content [ start + 1 .. end ] } } _ => content , } } else { let c1 = content [ 0 ] ; let c2 = content [ content . len ( ) - 1 ] ; if c1 == c2 && ( c1 == b'\'' || c1 == b'"' || c1 == b'`' ) { & content [ 1 .. content . len ( ) - 1 ] } else { content } } }
Remove single quotes, double quotes, backticks, or heredoc/nowdoc delimiters
surrounding a string literal.
Remove single quotes double quotes backticks or heredoc / nowdoc delimiters surrounding a string literal .
content
&[u8]
content
&[u8]