Crate split_every

source ·
Expand description

Split for every n occurrences of a pattern iteratively. This crate helps you split a string for every n occurrences 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<&str> =
    "Oh hi there I don't really know what to say".split_every_n_times(" ", 3);
println!("{}", splitter.next().unwrap());
println!("{}", splitter.next().unwrap());
println!("{}", splitter.next().unwrap());
println!("{}", splitter.next().unwrap());

Modules§

  • Import all necessary traits and structs.

Structs§

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

Traits§