fn split_args(args: &str) -> Vec<String> {
    let mut res = Vec::new();
    let mut current_arg = String::new();
    let mut in_quote = Vec::new();
    for c in args.chars() {
        if in_quote.is_empty() && c.is_whitespace() {
            res.push(current_arg);
            current_arg = String::new();
            continue;
        }
        current_arg.push(c);
        if c == '"' || c == '\'' {
            if in_quote.last() == Some(&c) {
                in_quote.pop();
            } else {
                in_quote.push(c);
            }
        }
    }
    if !current_arg.is_empty() {
        res.push(current_arg);
    }
    res
}
// Split a string containing space separated args into a vector respecting quoted strings
Split a string containing space separated args into a vector respecting quoted strings
Split a string containing space separated args into a vector respecting quoted strings
fn split_args(args: &str) -> Vec<String> {
    let mut res = Vec::new();
    let mut current_arg = String::new();
    let mut in_quote = Vec::new();
    for c in args.chars() {
        if in_quote.is_empty() && c.is_whitespace() {
            res.push(current_arg);
            current_arg = String::new();
            continue;
        }
        current_arg.push(c);
        if c == '"' || c == '\'' {
            if in_quote.last() == Some(&c) {
                in_quote.pop();
            } else {
                in_quote.push(c);
            }
        }
    }
    if !current_arg.is_empty() {
        res.push(current_arg);
    }
    res
}
fn split_args ( args : & str ) -> Vec < String > { let mut res = Vec :: new ( ) ; let mut current_arg = String :: new ( ) ; let mut in_quote = Vec :: new ( ) ; for c in args . chars ( ) { if in_quote . is_empty ( ) && c . is_whitespace ( ) { res . push ( current_arg ) ; current_arg = String :: new ( ) ; continue ; } current_arg . push ( c ) ; if c == '"' || c == '\'' { if in_quote . last ( ) == Some ( & c ) { in_quote . pop ( ) ; } else { in_quote . push ( c ) ; } } } if ! current_arg . is_empty ( ) { res . push ( current_arg ) ; } res }
Split a string containing space separated args into a vector respecting quoted strings
Split a string containing space separated args into a vector respecting quoted strings
args
&str