~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/knotless

git that lives in your Atmosphere account

Forked from chadtmiller.com/knotless

0
0
11 lines · 328 B Raw History
//! Splitting text into the things tally counts.

/// The words of `line`: runs of anything but whitespace.
pub fn words(line: &str) -> usize {
    line.split_whitespace().count()
}

/// The lines of `text`. A last line without a newline still counts.
pub fn lines(text: &str) -> impl Iterator<Item = &str> {
    text.lines()
}