2015-06-27 134 views
-6

你好朋友是编程新手,我想知道如何在txt 中搜索如下。搜索文本文件

我有以下内容

我今天赢了,如果他知道真相 今天,我很清醒,好像死 ,并与东西

我想要的东西没有更多的亲情和文本搜索这个文本有如果我想存储串的字真相

开始真理的话语,直到话里的意思字符串将

今天我作为真正清醒如果你死了,而早已不是

,并省略文字

的其余部分,如果一个例子有人功率感谢

已经我试图寻找这个词真相更多没有工作的位置。

回答

-1

你的问题有点不清楚。

如果你想找到一个字符串中的单词,你可以使用函数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