vb 随机读取txt里与text内容相近的文字

d:\1.txt里的内容:
【你好】丨你好丨hello丨大家好
【再见】丨再见丨88丨明天见
.......等等......
当text中的文字 =”再见“ 时如何找出并随机回复【再见】后面的三中里面的句?
求大虾赐教!

dim strLine$,arr ,ans$,ansIdx%
open "D:\1.txt" for input as #1
do untile eof(1)
line input #1,strLine
arr=split(strLine,"|")
if instr(arr(0),text1.text)>0 then
ansIdx=int(ubound(arr)*rnd)+1
ans=arr(ansIdx)
exit do
end if
loop
close #1
msgbox ans
温馨提示:答案为网友推荐,仅供参考
相似回答