Question Find Duplicates in arrays en count them as well

eMGee

New member
Joined
Dec 23, 2009
Messages
1
Programming Experience
1-3
Hi,

I'm a little bit stuck with something, i seeked about a week and can't find a solution to my problem.
This is my problem:
i have an array with dates in it and i want a list with the dates and how much that date is sequel to the amount of that dates in the array.
this is my code so far:


arrsVerschillendeDagen(iTellerke) is declared on moduleniveau
arriMaand(iTellerke) is declared on moduleniveau
arriJaar(iTellerke) is declared on moduleniveau

i have a subroutine too that redimension my arrays.

Private Sub FillArray()

For iCounter As Integer = 0 To arriDag.Length - 1

arrsVerschillendeDagen(iCounter) = arriDag(iCounter) & "/" & arriMaand(iCounter) & "/" & arriJaar(iCounter)

Next

'result: 14/10/2009, 20/12/2009, 20/12/2009, 14/12/2009, 14/12/2009, 14/12/2009
'
'I want to become this
'==> 14/10/2009 1
' 20/12/2009 2
' 14/12/2009 3

For iCounter2 As Integer = 3 To arrsVerschillendeDagen.Length - 1

iGetal = 1

For iCounter22 As Integer = iCounter2 + 1 To arrsVerschillendeDagen.Length - 1

If arrsVerschillendeDagen(iCounter2) = arrsVerschillendeDagen(iCounter22) Then

iGetal += 1



If Not sString.Contains(arrsVerschillendeDagen(iCounter2)) Then
sString &= arrsVerschillendeDagen(iCounter2) & " " & iGetal & "; "
Else

End If

Else

If Not sString.Contains(arrsVerschillendeDagen(iCounter2)) Then
sString &= arrsVerschillendeDagen(iCounter2) & " " & iGetal & "; "
End If

End If


Next

Next

MessageBox.Show(sString)

End Sub

Can anyone help me please!
I appreciate your help

Kind regards
eMGee
 
Back
Top