"count" (string::count)
Returns the number of (potentially overlapping) occurrences of the string s in this string.
Synopsis
int string.count(string s, CaseSensitivity cs = CaseSensitive);
Parameters
| Parameter | Description |
|---|---|
| s | String to be searched |
| cs |
Decides if the search is case sensitive. Can be either:
|
Description
Counts how often the specified substring occurs in the string.
Example
main()
{
string s = "Test test TEST";
DebugN(s.count("test", string::CaseSensitive));
DebugN(s.count("test", string::CaseInsensitive));
}
Console output:
WCCOAui1:["1"]
WCCOAui1:["3"]
Assignment
String
