【发布时间】:2018-06-15 06:57:21
【问题描述】:
我正在使用 JSR223 断言,我试图在文件中找到这两行的位置,如果没有收到则断言。
<BlockPath>XYZ\abc\a1\abc</BlockPath>
<FolderPath>XYZ\abc\a1</FolderPath>
我试过了:
int pos1 = tstStr.indexOf("<BlockPath>XYZ\abc\a1\abc</BlockPath>");
int pos2 = tstStr.indexOf("<FolderPath>XYZ\abc\a1</FolderPath>");
我收到了这个错误
Assertion failure message: javax.script.ScriptException:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script32.groovy: 7: unexpected char: '\' @ line 7, column 50.
ted.indexOf("<BlockPath>XYZ\abc\a1\ab
我需要从字面上寻找那两条线并获得它们的位置。确保不是 -1 或它们存在于文件中。我该怎么做?
【问题讨论】: