Like enumerate, but splits into blocks based on some value (like '\n'
for
lines) and gives the block number and the block position as (usize, usize)
toml
[dependencies]
enumerate-split = "0.0.1"
```rust use enumeratesplit::enumeratesplit;
let mut input = enumeratesplit("Some \n\nstring with a newline".chars(), '\n'); asserteq!(input.next(), Some(('S', (0, 0)))); asserteq!(input.next(), Some(('o', (0, 1)))); asserteq!(input.next(), Some(('m', (0, 2)))); asserteq!(input.next(), Some(('e', (0, 3)))); asserteq!(input.next(), Some((' ', (0, 4)))); asserteq!(input.next(), Some(('\n', (0, 5)))); asserteq!(input.next(), Some(('\n', (1, 0)))); assert_eq!(input.next(), Some(('s', (2, 0)))) ```