Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 | 1x 25x 25x 25x 23x 49x 49x 26x 26x | export const strCnt = (needle: string, haystack: string, offset: number = 0): number => { let cnt = 0; const needleLen = needle.length; if (needleLen === 0) return 0; while (true) { const index = haystack.indexOf(needle, offset); if (index < 0) return cnt; cnt++; offset = index + needleLen; } }; |