VBScript Instr function always return 0
我有一个由经典ASP编写的应用程序。 我需要比较string1是否包含string2,所以我使用instr函数。 但是,即使string1包含string2,它也始终返回0。我的代码在哪里出现问题?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | function Findstring(string1,string2) dim findstr,loc on error resume next loc= instr(1,Lcase(string1),Lcase(string2),1) if loc>0 then findstr=true else findstr= false end if end function |
1 2 3 4 5 | Function FindString( string1, string2 ) FindString = False On Error Resume Next FindString = CBool( InStr(1, LCase(string1), LCase(string2), 1) > 0 ) End Function |
如果
注意:如果比较运算符