我已经尝试过这段代码来验证文件的内容,并且我能够读取内容,但我应该读取与搜索单词直接相关的单词。
例如在文本文件中我有大约 10 行内容;在第三行我找到了搜索词,我应该阅读搜索词的下一行。考虑这是一个文本文件内容:
Hello
how
are
you
I am
fine
我需要搜索how
文本文件中存在的how
单词,如果找到该单词,我应该读取/验证该单词的下一行。
输出应该是are
open file "D:\Automation\EGGPlant\Archiecture\Script-Demo.suite\Resources\Demo.txt"
read from file "D:\Automation\EGGPlant\Archiecture\Script-Demo.suite\Resources\Demo.txt"
put file "D:\Automation\EGGPlant\Archiecture\Script-Demo.suite\Resources\Demo.txt" into WiFiInfo
重复 WiFiInfo 的行数次:
put line repeatindex() of WiFiInfo into output
if output contains "how" then
Log "found"
else
Log "Not found"
end if
end repeat
预期结果应该是are