1
我使用VB 9.0來分割文本文件,然後計算術語<sequence>
的出現次數。假設我也想用不同的格式來統計同一詞的出現次數,例如<sequence
然後它們組合在一起,這樣我將結果輸出到一個文本框,即如何計算與VB.NET的部分匹配詞的出現?
txtMyTerms.Text=<sequence>+<sequence
怎麼辦呢?我目前的代碼如下:
Dim str As String = txtSource.Text
Dim arr As String() = str.Split(Nothing)
Dim searchTerm As String = "<sequence>"
'create query to search for the term <sequence>
Dim matchQuery = From word In arr Where word.ToLowerInvariant() = searchTerm.ToLowerInvariant() Select word
' Count the matches.
Dim count As Integer = matchQuery.Count()
txtMyTerms.Text = count.ToString()