-6

I am new to programming and I wonder how to make a search in a text as follows.

I have a text with the following content

I won today as if he knew the truth Today I am lucid as if to die And had no more kinship with things

What I want and search this text has the word

truth if you

I wanted to store a string starting word of "truth" until the words had meaning the string would be

Today I am really lucid as if you were to die and had no

and omit the rest of the text.

Already I tried to search the position of the word "truth" but not worked.

PNP
  • 361
  • 5
  • 17

1 Answers1

0

Your question is a little unclear.

If you want to find a word inside a string you can use the function INSTR

Dim Position as integer = 0
Dim SampleText as String = "I won today as if he knew the truth Today I am lucid as if to die And had no more kinship with things"
'
Position = INSTR(SampleText, "truth")
if Position > 0 Then
  'matched
  msgbox("Word 'truth' found starting at position " & Position)
Else
  'not matched
  msgbox("Word 'truth' not found in text!")
End if
Zeddy
  • 2,079
  • 1
  • 15
  • 23