小弟不才,想用Instr函数检测看指定的文本中有没有关键词,但是总是不能成功。以下是我的源代码:
For OrderNum = 0 To List1.ListCount - 1 Keyword(OrderNum) = List1.List(OrderNum) KWFound = InStr(Doc, Keyword(OrderNum)) If KWFound > 0 Then Msgbox "挂马网页!!" End IfNext OrderNum
OrderNum、Keyword、KWFound为3个变量,Doc为先前加载的文件内容
经过分析发现Msgbox可以显示在此过程中所有Keyword,并且Doc格式也是正确的。
请大虾指点。
For OrderNum = 0 To List1.ListCount - 1 Keyword(OrderNum) = List1.List(OrderNum) KWFound = InStr(Doc, Keyword(OrderNum)) If KWFound > 0 Then Msgbox "挂马网页!!" End IfNext OrderNum
OrderNum、Keyword、KWFound为3个变量,Doc为先前加载的文件内容
经过分析发现Msgbox可以显示在此过程中所有Keyword,并且Doc格式也是正确的。
请大虾指点。
Dim str_Unicode As String
Open "C:\WINDOWS\a.txt" For Input As 1
str_UTF8 = StrConv(InputB$(LOF(1), 1), vbUnicode) '读到字符串
str_UTF8 = Right(str_UTF8, Len(str_UTF8) - 1) '第一个字符是格式标志,无实际意义,去掉
Close 1
Module_UTF8.m_bIsNt = True
str_Unicode = UTF8_Decode(str_UTF8) '转换为Unicode
Doc = str_Unicode
多余.
这里不是转换了吗.
看看str_UTF8和str_Unicode是什么吧.
首先排除 DOC 的问题。去掉循环,用你说可行的方式检查是否能够从同一个 DOC 查到关键字。再检查你的列表项值与你 "直接写关键词" 是否一致。你循环代码虽然啰嗦了一点,逻辑功能应该是没错的。For OrderNum = 0 To List1.ListCount - 1 If InStr(Doc, List1.List(OrderNum)) Then
Msgbox "挂马网页!!"
Exit For
End IfNext OrderNum