Ответ 1
Вы можете использовать InStr
функцию следующим образом:
Dim position As Integer
position = InStr(1, stringToSearch, stringToFind)
If position > 0 Then
' text is inside
Else
' text is not inide
End If
Как проверить, содержит ли text1 текст2 с помощью 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
Вы можете использовать InStr
функцию следующим образом:
Dim position As Integer
position = InStr(1, stringToSearch, stringToFind)
If position > 0 Then
' text is inside
Else
' text is not inide
End If
Используйте InStr
:
If InStr(text1, text2) > 0 Then
Это должно сделать трюк:
if (InStr(text1, text2) > 0)
Отметьте http://msdn.microsoft.com/en-us/library/8460tsh1(v=vs.80).aspx для особых случаев (параметры: Nothing, пустые строки и т.д.)
RTM = InStr(1, text1,text2)
if RTM > 0 then debug.print "Text2 was found at position: "; RTM