0
0
GGGiovanny Gongora
Finds all the indexes of a substring in a given string.
const indexOfSubstrings = function* (str: string, searchValue: string) {
let i: number = 0;
while (true) {
const r: number = str.indexOf(searchValue, i);
if (r !== -1) {
yield r;
i = r + 1;
} else return;
}
};