difft::words

Function split_words_up_to

Source
pub(crate) fn split_words_up_to(s: &str, limit: usize) -> Option<Vec<&str>>
Expand description

Split s into a vec of things that look like words and individual non-word characters. Return None if there more than limit items.

“foo..bar23” -> vec![“foo”, “.”, “.”, “bar23”]

See also split_words_and_numbers. Both these functions are hot, so they are separate implementations rather than passing a bool to customise number handling.