我正在使用VB 9.0来拆分文本文件,然后计算 term 的出现次数<sequence>
。假设我还想以不同格式计算相同术语的出现次数,例如<sequence
,然后将它们组合在一起,以便我将结果输出到文本框,即
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()