0
我想問問列表框中的項目。 我已經在列表框中分割字符串。所以如果我輸入了一個file.txt,它會被分成每個單詞。如何刪除相同的字符串,如果有相同的字符串inlistbox
我的問題是,如果file.text中有相同的字符串,如何刪除相同的字符串? 以及如何計算file.text中的每個單詞(每個單詞出現在file.text中的次數)?
這裏是我的fullcode
Dim s() As String = ListBox1.Items.Cast(Of String).ToArray()
For Each item As String In s
item = item.Replace(".", String.Empty)
item = item.Replace(Microsoft.VisualBasic.ControlChars.Quote, String.Empty)
item = item.Replace("(", String.Empty)
item = item.Replace(")", String.Empty)
item = item.Replace("-", String.Empty)
item = item.Replace(",", String.Empty)
ListBox2.Items.AddRange(item.Split(" "c))
Next
是你的字符串的數據排序? 含義,在你將它傳遞給你的字符串之前,它是否被排序? –