假设我有一组数字 23,56,128,567,我必须应用一个条件逻辑,其中如果变量 myData
存在于上述数字组中,则只有我继续,否则我不' t。
抱歉,必须研究一些遗留代码,并且不确定如何在 VBScript 中执行此操作。
最佳答案
您可以将值放入 Dictionary
中:
Set list = CreateObject("Scripting.Dictionary")
list.Add 23, True
list.Add 56, True
list.Add 128, True
list.Add 567, True
然后检查你的值是否存在于字典中:
If list.Exists(myData) Then
'do stuff
End If
安ArrayList
将是另一种选择:
Set list = CreateObject("System.Collections.ArrayList")
list.Add 23
list.Add 56
list.Add 128
list.Add 567
If list.Contains(myData) Then
'do stuff
End If
关于vbscript - 检查某个值是否在数字列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27931672/