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()