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

pub fn parse_quotes(s: impl AsRef<str>) -> Vec<String>
Expand description

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);