jjzjj

fooLineNumbers

全部标签

javascript - 在 Ace 编辑器中检索字符串的行号

我正在尝试检索ace编辑器中显示的文本中给定字符串的行号。示例:搜索“foo”返回:[4,5]条件:ace编辑器内容中第4、5行包含“foo”字符串 最佳答案 遍历所有行并检查indexOffunctionfindFooLineNumbers(editor,foo){varlines=editor.session.doc.getAllLines()varfooLineNumbers=[]for(vari=0,l=lines.length;i 关于javascript-在Ace编辑器中检索