Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21847

count kay in my Dictionary

$
0
0
I loop a txt file line by line with:

Code:

Dim f As Integer
    f = FreeFile
    Open Path For Input As #f
    Do While Not EOF(f)
        Line Input #f, tempstr
        If tempstr <> "" Then
            ...
        If Not MYDIC.Exists(COD) Then
            MYDIC.Add COD, DESCR_COD
        End If           
          ...
        End If
    Loop

    Close #f

COD and DESCR_COD are to valiable filed from a mid function.

I need, in addition of the dictionary array, to add a count how many Key are duplicate in the array, example:

COD not existx ad +1 to Key COD (is the first one presence of COD in dictionary array)

COD exists add +1 to the already existis Key, just filled with +1

ecc...

result if i found 12 var named AAAA, 2 for BBBB, 17 for CCCC:

12 - AAAA
2 - BBBB
17 - CCCC

I hope you ubdesrtand me.
Tkx

Viewing all articles
Browse latest Browse all 21847

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>