Function serenity::utils::parse_quotes[][src]

Important traits for Vec<u8>
pub fn parse_quotes(s: &str) -> Vec<String>

Turns a string into a vector of string arguments, splitting by spaces, but parsing content within quotes as one individual argument.

Examples

Parsing two quoted commands:

use serenity::utils::parse_quotes;

let command = r#""this is the first" "this is the second""#;
let expected = vec![
    "this is the first".to_string(),
    "this is the second".to_string()
];

assert_eq!(parse_quotes(command), expected);
use serenity::utils::parse_quotes;

let command = r#""this is a quoted command that doesn't have an ending quotation"#;
let expected = vec![
    "this is a quoted command that doesn't have an ending quotation".to_string(),
];

assert_eq!(parse_quotes(command), expected);