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

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_owned(),
    "this is the second".to_owned()
];

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_owned(),
];

assert_eq!(parse_quotes(command), expected);