05-16-2023 06:03 AM
Hi,
Want to know an easiest way to find if a particular element is exist in an array or not.
I have an array.
TestArray = Array("A", "B", "C", "D")
if some particular element is there in that array, based on availability condition, the script needs to be handled. whats the better way to do it.
Example:
if isinTestArray("C") = True then
'execute some lines
Else
'execute some other lines
end if
regards,
Durai
Solved! Go to Solution.
05-16-2023 10:28 AM - edited 05-16-2023 10:29 AM
Dim TestArray: TestArray = Array("A", "B", "C", "D")
Dim Item: Item = "C"
If Ubound(Filter(TestArray, Item)) > -1 Then
MsgBox "Found"
Else
MsgBox "Not found!"
End If
Source: https://stackoverflow.com/questions/11879612/qtp-checking-if-an-array-of-strings-contains-a-value