string.count
This function counts the number of non-overlapping instances of a substring in the input string.
Syntax
string.count(str, substr)
Arguments
|
Argument |
Type |
Description |
|---|---|---|
|
str |
string |
Source string |
|
substr |
string |
Substring whose instances must be searched for in the source string |
Returns
|
Type |
Description |
|---|---|
|
int |
Number of instances of the substring in the string. If a substring is an empty string, the function returns 1 + the number of Unicode points in the input string. |
Examples
The function string.count("hello flogo", "o") returns 3.