QTP – Search for String inside of another String

If you looking for a string inside of another you simply need to use the function inStr.


Dim str
str = "abcdef"

' Determine if a string contains a substring, check the return value:
' 0 = no substring found

searchStr = "abc"
If InStr( str, searchStr ) = 0 Then
Print "substring not found within str"
Print "substring Found within str"
End If

For more examples checkout http://www.advancedqtp.com/string-contains-substring/