我正在尝试使用 javascript/jquery 查找文本索引,但我没有得到确切的解决方案。
考虑文字是这样的......
Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.Hi all. hello world. Hi all. Hello world.
如何在任何行上获得所选“Hello”单词的确切位置?我尝试了 indexOf,但它给了我第一个 hello 文本索引。请任何人为此提出解决方案。
提前致谢。