Function str_windows::str_windows[][src]

pub fn str_windows<'a>(
    input: &'a str,
    size: usize
) -> impl Iterator<Item = &'a str>

Returns substrings of length size, similar to slice::windows.

Examples

use str_windows::str_windows;

let input = "s 😀😁";
let mut iter = str_windows(input, 3);
assert_eq!(iter.next(), Some("s 😀"));
assert_eq!(iter.next(), Some(" 😀😁"));
assert!(iter.next().is_none());