How to check if text1 contains text2 using vb6 ?
Dim text1 as string
Dim text2 as string
text1 = "hello world I am Anas"
text2 = "Anas"
if (check if text2 is in text1) 'the result should be true or false
In visual basic, the string Contains method is useful to check whether the specified substring exists in the given string or not and it will return a boolean value. In case, if substring exists in a string, then the Contains method will return true otherwise it will return false.
contains method in vb.net. Contains method of the string class determine that the substring is present inthe string or not, or we can say contains method checks whether specified parameter string exist inthe string or not. this method returns boolean type value true and false.
You can use InStr
function like this:
Dim position As Integer
position = InStr(1, stringToSearch, stringToFind)
If position > 0 Then
' text is inside
Else
' text is not inide
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With