fivem-ts

a library to speed up the development of Fivem scripts and frameworks


Project maintained by Purpose-Dev Hosted on GitHub Pages — Theme by mattgraham

fivem-ts - Documentation v0.7.5Docs


fivem-ts - Documentation v0.7.5 / Shared / countSubstringOccurrences

Function: countSubstringOccurrences()

countSubstringOccurrences(input, substring): number

Counts the occurrences of a substring within a string.

Parameters

input: string

The string to search within.

substring: string

The substring to count occurrences of.

Returns

number

The number of times the substring occurs in the input string.

Example

const result = countSubstringOccurrences("hello hello world", "hello");
console.log(result); // 2

Defined in

shared/utils/FString.ts:109