代码拉取完成,页面将自动刷新
Fast module for counting the number of occurrences of a substring inside a string.
npm install quickly-count-substrings --save
const count = require('quickly-count-substrings')
const str = 'The quick brown fox jumps over the lazy dog'
count(str, 'o') // => 4
result = count(str, substr[, options])
Returns number of occurrences of substr
in str
.
Arguments:
str
- The string to search insubstr
- The string to search foroptions
- Optional. If {overlap: true}
, overlapping substrings
will be counted (default: {overlap: false}
)Counting substrings in a 24MB string:
# quickly-count-substrings
ok ~44 ms (0 s + 43676071 ns)
# count-substring
ok ~134 ms (0 s + 133563148 ns)
# string-occurrence
ok ~184 ms (0 s + 183978927 ns)
# needle-string
ok ~116 ms (0 s + 115521420 ns)
# regex-occurrence
ok ~169 ms (0 s + 169180879 ns)
# count-strings
ok ~491 ms (0 s + 490783663 ns)
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。