VBS读取某个文本内容来判断文本里存不存在某个字符怎写?
比如VBS读取了1.txt里的所有内容。
然后判断这里面存不存在。比如 "love" 如果1。TXT里面有love就msgbox "yes"
没有就no
比如VBS读取了1.txt里的所有内容。
然后判断这里面存不存在。比如 "love" 如果1。TXT里面有love就msgbox "yes"
没有就no
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
strA = "love ***"
strB = "Love ***"
If instr(strA,"love") > 0 Then msgbox "yes" '区分大小写
If instr(1,strB,"love",1) > 0 Then msgbox "yes" '不区分大小写strA = "l*********"
If instr(strA,"love") = 0 Then msgbox "no"Originally posted by abcd at 2008-4-22 00:19:
楼主已经说了,读取某个文本,来判断,只能是用正则了。
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("a.txt",1)
str = f.ReadAll
f.Close
If instr(str,"love") = 0 Then msgbox "no"
If instr(str,"love") > 0 Then msgbox "yes"asdas
asd
loveOriginally posted by zh159 at 2008-4-22 01:40 AM:
试试看
VBS
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("a.txt",1)
str = f.ReadAll
f.Close
If instr(str,"love") = ...
Originally posted by abcd at 2008-4-22 11:39:
这种用法处理不了特殊字符
Originally posted by abcd at 2008-4-22 11:55:
双引号
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("a.txt",1)
str = f.ReadAll
f.Close
var = """"
If instr(str,var) = 0 Then msgbox "no"
If instr(str,var) > 0 Then msgbox "yes"
asdas
asd
love
"