Я хочу найти последовательность строк с помощью rxjs
Например
Целевая строка: 01234010
Строка соответствия: 01
ответ = 2
У меня есть решение с использованием javascript
let index = 0;
while (true) {
let foundIndex = targetSequence.indexOf(matchSequence, index);
if (foundIndex == -1) break;
index = foundIndex + 1;
}
но проблема в том, что я должен использовать rxjs с этим скелетным кодом
import { from, Observable } from "rxjs";
const targetSequence = `01234010`;
const matchSequence = "01";
const _target = from(targetSequence);
const _output: Observable<number> = _target.pipe(
// here is your code
);
_output.subscribe({
next: val => console.log(`count : ${val}`)
});
у вас есть идеи?