Подтвердить что ты не робот

Как проверить, содержит ли text1 text2 с помощью vb6?

Как проверить, содержит ли 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
4b9b3361

Ответ 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

Ответ 2

Используйте InStr:

If InStr(text1, text2) > 0 Then

Ответ 4

RTM = InStr(1, text1,text2)

if RTM > 0 then debug.print "Text2 was found at position: "; RTM