(searchString, string)
| 204 | } |
| 205 | |
| 206 | function getIndicesOf(searchString, string) { |
| 207 | const searchStrLen = searchString.length |
| 208 | if (searchStrLen === 0) return [] |
| 209 | |
| 210 | let startIndex = 0 |
| 211 | let index |
| 212 | const indices = [] |
| 213 | |
| 214 | while ((index = string.indexOf(searchString, startIndex)) > -1) { |
| 215 | indices.push(index) |
| 216 | startIndex = index + searchStrLen |
| 217 | } |
| 218 | |
| 219 | return indices |
| 220 | } |
| 221 | |
| 222 | function regexIndexOf(string, regex, startPos) { |
| 223 | const indexOf = string.substring(startPos || 0).search(regex) |