项目

一般

简介

DelTextList » 历史记录 » 版本 2

tejie, 2025-09-03 14:17

1 2 tejie
h4. _*%{color:green}delTextList%*_
2
3 1 machenhe
从指定文件中删除一行字符串
4
5 2 tejie
标签:命令定义^delTextList
6 1 machenhe
7
*格式*
8
|命令名		|参数1	 |参数2	      |
9
|delTextLis	|文件路径|待删除字符串|
10
11
*说明*
12 2 tejie
|^.参数1|待处理字符串的文件路径
13 1 machenhe
路径需要基于..\Mir200\Envir
14
%{color:lightGrey}举例
15
设定路径为
16
\testlist.txt
17
完整路径
18 2 tejie
..\Mir200\Envir\testlist.txt%|
19
|参数2|待删除字符串|
20 1 machenhe
21 2 tejie
*{color:red}如没有找到与指定字符串匹配的行,则不执行*
22 1 machenhe
23
-
24
-
25
26 2 tejie
h4. *%{color:deepskyblue}特戒引擎脚本示例:%*
27 1 machenhe
28
bq. 预制数据文件
29
..\Mir200\Envir\数据文件\测试数据文件.txt
30
文件内容如下
31
测试数据1
32
测试数据2
33
测试数据3
34
测试数据4
35
测试数据5
36
37
38
bq. [@main]
39
#if
40
#act
41 2 tejie
[[mov]] s$file \数据文件\测试数据文件.txt
42 1 machenhe
 
43
#if
44 2 tejie
[[checkTextList]] <$str(s$file)> 测试数据1
45 1 machenhe
#act
46 2 tejie
[[getStringPos]] <$str(s$file)> 测试数据1
47
[[inc]] n0 1
48
[[sendMsg]] 6 特戒提示,"测试数据1"在第<$str(n0)>行
49
[[print]] 特戒提示,"测试数据1"在第<$str(n0)>行
50 1 machenhe
&nbsp;
51
*%{color:green}delTextList%* <$str(s$file)> 测试数据1
52 2 tejie
[[sendMsg]] 6 特戒提示,尝试删除"测试数据1"
53
[[print]] 特戒提示,尝试删除"测试数据1"
54 1 machenhe
&nbsp; 
55
#elseAct
56 2 tejie
[[sendMsg]] 6 特戒提示,文件中没有对应字符
57
[[print]] 特戒提示,文件中没有对应字符
58
[[break]]
59 1 machenhe
&nbsp;
60
#if
61 2 tejie
not [[checkTextList]] <$str(s$file)> 测试数据1
62 1 machenhe
#act
63 2 tejie
[[sendMsg]] 6 特戒提示,字符串删除成功
64
[[print]] 特戒提示,字符串删除成功