View Full Version : if variable in array
ghell
03-03-2004, 08:39 PM
ok someone told me i could use something like "if variablename IN arrayname then... " but is there an "in" function and if so how is it used? i have an array of words that if the variable is equal to them it will skip them but i dont know if there is an in function or not :p this means that a for loop will not work i think because i would need to generate an if statement or something, dont think i can do that but if i can i wil also take that as the answer :D
Roy Sinclair
03-03-2004, 09:17 PM
Have you tried it?
There is a way to iterate through objects using "in":
for each testObject in objectContainer
...(do something with testObject here)
next
glenngv
03-04-2004, 03:20 AM
Do you want just to check the existence of a string in the array or do you want to get the array index of the matched string?
If the former, you can simply do:
If Instr(1, Join(MyArray), "StringToSearch", 1)>0 Then
'found
Else
'not found
End If
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.