Skip to main content

word_count

Function word_count 

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

Count the number of whitespace-delimited tokens in text.

ยงExamples

use readable_rs::shared_utils::word_count;

assert_eq!(word_count("Hello World      Another word"), 4);
assert_eq!(word_count(""), 0);
assert_eq!(word_count("   "), 0);