A4-Tacks / str_windows-rs

Iterator over windows of chars (as `&str`) in a `&str`.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

str_windows-rs

Provides an iterator over windows of chars (as &strs) of a &str.

Does not allocate on the heap.

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());

About

Iterator over windows of chars (as `&str`) in a `&str`.

License:MIT License


Languages

Language:Rust 100.0%