Skip to main content

word_count

Function word_count 

Source
pub fn word_count(text: &str) -> usize
Expand description

Count words in text.

Words are defined as whitespace-separated sequences.

ยงExample

use html_cleaning::text;

assert_eq!(text::word_count("hello world"), 2);
assert_eq!(text::word_count(""), 0);