行为
delTextList¶
从指定文件中删除一行字符串
标签:命令定义^delTextList
格式命令名 | 参数1 | 参数2 |
delTextLis | 文件路径 | 待删除字符串 |
参数1 | 待处理字符串的文件路径 路径需要基于..\Mir200\Envir 举例 设定路径为 \testlist.txt 完整路径 ..\Mir200\Envir\testlist.txt |
参数2 | 待删除字符串 |
如没有找到与指定字符串匹配的行,则不执行
特戒引擎脚本示例:¶
预制数据文件
..\Mir200\Envir\数据文件\测试数据文件.txt
文件内容如下
测试数据1
测试数据2
测试数据3
测试数据4
测试数据5
[@main]
#if
#act
mov s$file \数据文件\测试数据文件.txt
#if
checkTextList <$str(s$file)> 测试数据1
#act
getStringPos <$str(s$file)> 测试数据1
inc n0 1
sendMsg 6 特戒提示,"测试数据1"在第<$str(n0)>行
print 特戒提示,"测试数据1"在第<$str(n0)>行
delTextList <$str(s$file)> 测试数据1
sendMsg 6 特戒提示,尝试删除"测试数据1"
print 特戒提示,尝试删除"测试数据1"
#elseAct
sendMsg 6 特戒提示,文件中没有对应字符
print 特戒提示,文件中没有对应字符
break
#if
not checkTextList <$str(s$file)> 测试数据1
#act
sendMsg 6 特戒提示,字符串删除成功
print 特戒提示,字符串删除成功