#comma #quote #iterator #string #separated #ignoring #comma-seperated

comma-separated

Iterator over a comma-seperated string, ignoring any commas inside quotes

1 unstable release

new 0.1.0 Nov 28, 2024

#2 in #separated

Download history 136/week @ 2024-11-24

136 downloads per month
Used in real-ip

MIT/Apache

9KB
162 lines

Comma-separated

Iterator over a comma-seperated string, ignoring any commas inside quotes

use comma_separated::CommaSeparatedIterator;

fn main() {
    let input = r#"foo, "bar", 'quoted, part'"#;
    let iterator = CommaSeparatedIterator::new(input);
    assert_eq!(vec!["foo", "\"bar\"", "'quoted, part'"], iterator.collect::<Vec<_>>());
}

lib.rs:

Iterator over a comma-seperated string, ignoring any commas inside quotes

Example

let input = r#"foo,"bar",'quoted, part'"#;
let iterator = CommaSeparatedIterator::new(input);
assert_eq!(vec!["foo", "\"bar\"", "'quoted, part'"], iterator.collect::<Vec<_>>());

No runtime deps