Function count

Source
pub fn count(text: String, substring: &str) -> usize
Expand description

Count how many times a substring appears in another string

ยงExample

use pythonic_helper::strings::count;
 
let text = String::from("Hello World");
let substring = "l";
let count = count(text, substring);
 
assert_eq!(count, 3);