2015-06-27 237 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