如何instr判断多个?

请问asp如何instr判断多个,用,分割,代码如下。请问可以实现吗?谢谢。

aa=Request.ServerVariables("REMOTE_ADDR")
if instr(aa,"99.88,110.52,43.80.235,11.9.67.180")>0 then
Response.Write "ok"
response.End
end if
阅读 1.8k
1 个回答

循环遍历:

<%
Dim aa, ipList, ip, found
aa = Request.ServerVariables("REMOTE_ADDR")

ipList = Array("99.88", "110.52", "43.80.235", "11.9.67.180")
found = False

For Each ip In ipList
    If InStr(aa, ip) > 0 Then
        found = True
        Exit For
    End If
Next

If found Then
    Response.Write "ok"
    Response.End
End If
%>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏