本帖最后由 aea 于 2022-6-3 12:23 PM 编辑
#file 1 "pkuxkx/"@sj_book".txt"
rd=%grep(1,@sj_neirong)
#close 1
#show @rd
#if (%pos( "--", @rd)>0) {rd1=chanting %word( @rd, 4, "--") %word( @rd, 3, "--")}
#EXEC @rd1
打开 目录 pkuxkx 下 @sj_book.txt 文件
%grep 返回行数
Syntax: %grep(i,s)
search the ith file and return lines that match the pattern in s.
#case (%null(@hdtemp)+1) {#sh A!} {#sh B!}
当hdtemp为空,0+1 非空,1+1,分别运行显示A B
#if %pos(|@answer1|,@hdtemp) {answer 1}
如果,@hdtemp中含有 |@answer1|,则非空,运行 answer 1
Syntax: %pos(p,s)
return the position of pattern p in string s. Return 0/false if not found
Examples:
#SHOW %pos(ABC,12AB56ABC10ABC)
displays: 7
#if (%pos( "--", @rd)>0) {rd1=chanting %word( @rd, 4, "--") %word( @rd, 3, "--")}
#exec @rd1
当--在@rd中存在,运行 @rd1
Syntax: %word(s,i,d)
return the ith word of string s, delimited by string d (if d is missing, a space is used as the word delimiter
Examples:
#SHOW %word("abc defg hijk lm",3)
displays:
hijk
#SHOW %word("This, is a, test.",2,", ")
displays:
is a
北大侠客行MUD,中国最好的MUD |