以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  if dr("状态") in ("1","2","3") then  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=125106)

--  作者:huangxueyao
--  发布时间:2018/9/20 8:27:00
--  if dr("状态") in ("1","2","3") then
if dr("状态") in ("1","2","3") then

这样会报错,有类似的写法么?
[此贴子已经被作者于2018/9/20 8:29:58编辑过]

--  作者:有点甜
--  发布时间:2018/9/20 8:55:00
--  

没有这种语法。如果要简便,可以这样写

 

Dim ary = "1,2,3,4,5,6,7".split(",")

If array.indexof(ary, 5) >= 0 then

    msgbox("包含")

End If

[此贴子已经被作者于2018/9/20 15:13:23编辑过]

--  作者:aizaishuzui
--  发布时间:2018/9/20 15:12:00
--  
又学习到一种,感谢老师
Dim ary = "1,2,3,4,5,6,7,8".split(",")
Dim s As String = "10"
Dim i As Double = Array.indexof(ary,s)
If i = -1 Then
    msgbox("不包含")
Else
    msgbox(ary(i))
End If