Foxtable(狐表)用户栏目专家坐堂 → 请教集合


  共有2023人关注过本帖树形打印复制链接

主题:请教集合

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/21 13:26:00 [显示全部帖子]

Dim ary() As String = {"a","b","ab","bc","a","b"}
Dim dic As new Dictionary(Of String, Integer)
For Each s As String In ary
    If dic.ContainsKey(s) = False Then
        dic.Add(s, 1)
    Else
        dic(s) = dic(s) + 1
    End If
Next

For Each k As String In dic.Keys
    If dic(k) > 1 Then
        output.show(k)
    End If
Next


 回到顶部