string-indexes
Version:
Retrieves all indexes, in non-overlapping ranges, of a substring in a string.
24 lines (14 loc) • 359 B
Markdown
Retrieves all indexes, in non-overlapping ranges, of a substring in a string.
```sh
npm install string-indexes
```
```ts
import getIndexes from 'string-indexes';
// Let's retrieve all the indexes for "xx"
getIndexes ( 'xxxx__xxxx__xxxxx', 'xx' ); // => [0, 2, 6, 8, 12, 14]
```
MIT © Fabio Spampinato