a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / countSubstringOccurrences
countSubstringOccurrences(
input
,substring
):number
Counts the occurrences of a substring within a string.
• input: string
The string to search within.
• substring: string
The substring to count occurrences of.
number
The number of times the substring occurs in the input string.
const result = countSubstringOccurrences("hello hello world", "hello");
console.log(result); // 2