Crate split_every

source ·
Expand description

Split for every n occurences of a pattern iteratively. This crate helps you split a string for every n occurences of a pattern.
It contains an exclusive iterator.

§Examples

use split_every::{SplitEveryImpl, SplitEvery};
// This prints: "Oh hi there"
//              "I don't really"
//              "know what to"
//              "say".
let mut splitter: SplitEvery =
    "Oh hi there I don't really know what to say".split_every_n_of_str(" ", 3);
println!("{}", splitter.next().unwrap());
println!("{}", splitter.next().unwrap());
println!("{}", splitter.next().unwrap());
println!("{}", splitter.next().unwrap());

Structs§

  • An Iterator struct for splitting a string every n occurences of a pattern.

Traits§