Search Docs
count
Counts the number of occurrences of a substring in a string.
import { count } from 'funtool/string' count('hello world, hello again', 'hello'); // ✅ 2 count('abc', 'x'); // ❌ 0
function count(str: string, substr: string): number
str
string
substr
number