[][src]Function voca_rs::count::count_substrings

pub fn count_substrings(subject: &str, substring: &str) -> usize

Counts the number of substring appearances in subject.

Arguments

  • subject - The string where to count.
  • substring - The substring to be counted.

Example

use voca_rs::*;
count::count_substrings("bad boys, bad boys whatcha gonna do?", "boys");
// => 2
count::count_substrings("Cafe\u{0301} del Mar", "Café"); // or "Café del Mar"
// => 1
count::count_substrings("every dog has its day", "cat");
// => 0
use voca_rs::Voca;
"bad boys, bad boys whatcha gonna do?"._count_substrings("boys");
// => 2