项目

一般

简介

字符串 » 历史记录 » 版本 16

yangdefeng, 2021-11-03 21:15

1 1 yangdefeng
{{toc}}
2
3
h3. 字符串
4
5
h4. *_%{color:green}pgExtractString%_*
6
7
字符串分割
8
9
格式:
10
11
|命令名         |参数1 |参数2   |参数3 |参数4 |
12
|pgExtractString|分割符|分割对象|变量名|变量名|
13
14
说明:
15
* 参数1:自定义的分割符
16
* 参数2:待分割的字符串
17
* 参数3:存放分割结果的变量列表,变量名_1、变量名_2、依次类推
18
* 参数4:存放分割数量
19
20
bq. %{color:lightgrey};用例1:%
21
[@main]
22
#if
23
#act
24
pgExtractString | 测试文本1|测试文本2 S$测试变量 N0
25
<notextile>sendMsg 6 你将文本分割了,并将分割后的内容保存在变量【S$测试变量_1】和【S$测试变量_2】中,他们的值分别是<$STR(S$测试变量_1)>和<$STR(S$测试变量_2)>,分割后共获得了【<$STR(N0)>】个内容</notextile>
26
%{color:lightgrey};--%
27
%{color:lightgrey};用例:2%
28
[@main]
29
#act
30
mov N$幸运等级 <$str(U1017)>
31
dec N$幸运等级 1
32
%{color:lightgrey};读取文件指定行%
33
getListString ..\QuestDiary\幸运项链\数据表.txt <$str(N$幸运等级)> S$返回串
34
%{color:lightgrey};对字符串分割取值%
35
pgExtractString | S$返回串 S$返回值 N$分割数
36
<notextile>mov N$幸运倍攻加成 <$STR(S$返回值_6)></notextile>
37
38
----
39
40
h4. *_%{color:green}extractString%_*
41
42
格式:
43
说明:
44
45
bq. 用例:
46
#act
47
mov S0 战神盔甲(男):裁决之杖:绿色项链:黑铁头盔:骑士手镯:骑士手镯:力量戒指:力量戒指
48
<notextile>extractString : <$STR(S0)> s1 s2 s3 s4 s5 s6 s7 s8</notextile>
49
<notextile>sendmsg 6 分割结果:<$STR(S1)> <$STR(S2)> <$STR(S3)> <$STR(S4)> <$STR(S5)> <$STR(S6)> <$STR(S7)> <$STR(S8)></notextile>
50
51
----
52
53
h4. _*%{color:green}ansiReplaceText%*_
54
55
字符串替换
56
57
格式:
58
59
|命令名         |参数1      |参数2   |参数3  |
60
|ANSIREPLACETEXT|字符串变量 |旧字符串| 新字符|
61
62
说明:
63
64
* 参数1:
65
* 参数2:
66
* 参数3:
67
68
----
69
70
h4. *_%{color:green}getStringPos%_*
71
72
*取字符串在列表中的位置*
73
取字符串在列表中的下标
74
75
格式:getStringPos ..\QuestDiary\测试.txt 管理员
76
说明:
77
78
sendMsg 6 字符串在列表中的位置:<notextile><$STR(N0)></notextile>
79
80
----
81
82
h4. *_%{color:green}addTextListEx%_*
83
84
*字符串写入文件*
85
86
格式:
87
88
|_.命令名     |_.参数1|_.参数2 |_.参数3 |
89
|addTextListEx|路径   |写入文本|写入行号|
90
91
说明:
92
* 参数1:支持变量传值
93
* 参数2:支持变量传值
94
95
bq. 用例:
96
addTextListEx ..\QuestDiary\TestList.txt <$USERNAME> 0
97
98
99
*_%{color:green}addTextList%_*
100
格式:AddTextList ..\TestList.txt 您的名字
101
格式:AddTextList ..\TestList.txt 您的名字 您的性别
102
说明:无行号
103
104
----
105
106
h4. _%{color:green}delTextList%_
107
108
*删除文件中的字符串*
109
110
格式:DelTextList ..\TestList.txt 您的名字
111
格式:DelTextList ..\TestList.txt 您的名字 您的性别
112
113
----
114
115
h4. _%{color:green}getListString%_
116
117
*从文件中取字符串*
118
*读取文本中指定行的内容*
119
120
格式:
121
getListString ..\QuestDiary\NewFile.txt 0 <notextile>S$tmp</notextile>
122
123
说明:读取文本文件指定行的内容
124
125
----
126
127
h4. _%{color:green}inc%_
128
129
*字符串加法*
130
131
格式:
132
inc 字符串1 字符串2
133
134
说明:
135
136
----
137
138
h4. _%{color:green}dec%_
139
140
*字符串减法*
141
142
格式:
143
dec 字符串1 字符串2
144
145
说明:
146
147
----
148
149
h4. _%{color:green}compareText%_
150
151
*字符串比对*
152
153
格式:
154
CompareText 字符串1 字符串2
155
156
说明:
157
158
例子:
159
CompareText <$KILLMONNAME> 宝藏守卫者
160
161
----
162
163
h4. _*%{color:green}setStringBlank%*_
164
165
格式:
166
167
|命令名        |参数1|参数2|参数3|
168
|setStringBlank|变量 |长度 |前后 |
169
170
说明:
171
172
* 参数1:变量支持A与S
173
* 参数2:设定变量固定长度
174
** 单个字母1个长度
175
** 单个汉字2个长度
176
* 参数3:前置或后置补空格
177
** 0,前置
178
** 1,后置
179
180
bq. 用例:
181
mov S10 gameofmir引擎
182
<notextile>setStringBlank <$STR(S10)> 20 0</notextile>
183
;字符串原长度13
184
;给字符串前面补7个空格
185
186
----
187
188 2 yangdefeng
h3. 字符串随机
189
190 8 yangdefeng
h4. _%{color:green}getRandomText%_
191
192
*从文件中随机获取一行字符串*
193
194
格式: 
195
GetRandomText 文件路径 变量(S0--S99) 指定行(0-10000)
196
197
说明: 
198 9 yangdefeng
未指定行时,随机取某一行的字符串.
199 8 yangdefeng
200
----
201
202 2 yangdefeng
h4. _%{color:green}getRandomLineText%_
203 6 yangdefeng
204
*从文件中随机取文本*
205
206 1 yangdefeng
格式:
207
208 8 yangdefeng
|命令名           |参数1|参数2|
209
|getRandomLineText|路径 |变量 |
210 1 yangdefeng
211
212 8 yangdefeng
说明:
213 6 yangdefeng
214 10 yangdefeng
bq. %{color:lightgrey}用例1:从文件..\QuestDiary\配置文件\1一大陆武器.txt中随机取值%
215
#act
216 1 yangdefeng
mov S$tmp 1一大陆武器
217
<notextile>getRandomLineText ..\QuestDiary\配置文件\<$STR(S$tmp)>.txt S$武器</notextile>
218 10 yangdefeng
%{color:lightgrey}用例2:%
219
#act
220 8 yangdefeng
getRandomLineText ..\QuestDiary\装备列表.txt S0
221 6 yangdefeng
222
----
223 2 yangdefeng
224 1 yangdefeng
h3. 字符串检测
225 12 yangdefeng
226
h4. _%{color:green}checkStringlength%_
227
228
*检测字符串长度*
229
230
格式:
231
checkStringlength 字符串 操作符(<,>,=) 位数
232
233
说明:一个汉字位数为2
234
235
bq. 用例:
236
[@test]
237
#IF
238 14 yangdefeng
checkStringlength D3dm2 > 3
239
#act
240
sendMsg 6 D3dm2大于3个字符
241 1 yangdefeng
#ELSESAY
242 14 yangdefeng
sendMsg 6 D3dm2小于3个字符
243
244
----
245
246
h4. _%{color:green}checkTextList%_
247
248
*检查字符串是否在指定文件中*
249
250
格式:
251
CHECKTEXTLIST ..\QuestDiary\充值系统\10元卡号.txt <notextile><$STR(S$2)></notextile>
252
253
说明:
254
255
格式:
256
CHECKTEXTLIST ..\QuestDiary\充值系统\10元卡号.txt <notextile><$STR(S$2)> <$STR(S$3)></notextile>
257
258
说明:
259
S$2和S$3的值在“10元卡号.txt”文本中以空格分开
260 12 yangdefeng
261
----
262 16 yangdefeng
263
h4. _*%{color:green}checkContainsText%*_
264
265
*检查字符串A是否包涵字符串B*
266
267
格式:
268
checkContainsText 字符串A 字符串B
269
270
说明:
271
272
bq. 用例:
273
#if
274
<notextile>checkContainsText www.gameofmir.com gameofmir.com</notextile>
275
#act
276
sendMsg 6 包涵
277
#elseAct
278
sendMsg 6 不包涵
279
280
----