Function: count()
ts
function count(text, substring): number;Counts how many times substring appears in text. 统计子串在文本中出现的次数。
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Source text / 源文本 |
substring | string | Substring to count / 子串 |
Returns
number
Occurrence count / 出现次数
Example
ts
count('abcabc', 'a')
// => 2Since
1.2.0