Checks the string to see if it is "quoted"
(str: &str)
| 40 | |
| 41 | /// Checks the string to see if it is "quoted" |
| 42 | pub fn is_quoted_string(str: &str) -> bool { |
| 43 | if str.len() < N_BYTES_NO_EVAL_QUOTE_CHAR { |
| 44 | return false; |
| 45 | } |
| 46 | let bytes = str.as_bytes(); |
| 47 | return bytes[bytes.len()-N_BYTES_NO_EVAL_QUOTE_CHAR..] == NO_EVAL_QUOTE_CHAR_AS_BYTES; |
| 48 | } |
| 49 | |
| 50 | /// Converts 'string' into a "quoted" string -- use is_quoted_string and unquote_string |
| 51 | /// IMPORTANT: this assumes the string is quoted -- no check is made |