Function rustml::sliding::string_slider
[−]
[src]
pub fn string_slider<'a>(s: &'a str, winlen: usize) -> Option<StringSlider<'a>>
Creates a sliding window of fixed size over a string.
Returns None
if winlen
is zero, otherwise a StringSlider
is
returned that implements Iterator
to iterate through the
string.
use rustml::sliding::*; let s = "hello"; assert_eq!( string_slider(&s, 3).unwrap().collect::<Vec<&str>>(), vec![ "hel", "ell", "llo" ] );