I have a string array that contains a list every string in that list contains 4 initials, I want to compare how many times the initials repeat themselves
If the initials are repeated I want to add those initials to a List<string>
and count how many times the initial repeat using a List<int>
If
ENFE
appears in the array add that toList<string>
andList<int>
counts = 1
If
ENFE
appears againcounts = 2
If
CCOM
appears add toList<string>
andList<int>
counts = 1
....
This is the code i have
foreach(string item in lstProgramas.Items)
{
if(tempDeptSiglas[1] == item)
{
deptSiglas.Add(tempDeptSiglas[1]);
contador.Add(+1);
}
}
I'm getting that tempDeptSiglas
is null