统计主字符串中包含多少个子字符串。
Example
str.count('Hello world', 'l') // 3
str.count('Hello world', 'Hello') // 1
str.count('Hello world', 'foo') // 0
str.count('Hello world', '') // 0
str.count('', 'x') // 0
str.count('', '') // 0
str.count(12345, 1) // 1
Parameters:
Name | Type | Description |
---|---|---|
str |
String | 主字符串 |
subStr |
String | 子字符串 |
Returns:
个数
- Type
- Number