1 unstable release
new 0.1.0 | Nov 28, 2024 |
---|
#2 in #separated
136 downloads per month
Used in real-ip
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<_>>());