7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Form_Load()
Dim s$, v, i%, dic
s = "AAA|BBB|CCC|AAA|DDD|AAA|CCC|BBB|EEE|FFF"
v = Split(s, "|")
Set dic = CreateObject("scripting.dictionary")
For i = 0 To UBound(v)
dic(v(i)) = Val(dic(v(i))) + 1
Next
s = ""
For Each v In dic.keys
s = s & v & "," & dic(v) & "|"
Next
MsgBox s
End Sub
string s = "AAA|BBB|CCC|AAA|DDD|AAA|CCC|BBB|EEE|FFF";
var result = from x in s.Split('|')
group x by x into g
select g.Key + g.Count().ToString();
Console.WriteLine(string.Join("|"), result.ToArray());