Hey guys,
I'm a bit stuck with this issue...
I have a list of comma separated strings.
some of them have a duplicate field in them.
what I want at the end of this process is a List of strings (comma seperated again) with any of the duplicates being marked with a number (ideally 1 for the first duplicate, 2 for the 2nd etc.). The number needs to be appended to a different field to the field i'm checking for duplicates in.
this is what i've tried... it makes each one unique but i only want to append x to the duplicate values
int x = 0;
foreach (string PugString in PUGList)
{
string[] PugDeets = PugString.Split(',');
PugDeets[7] = PugDeets[6].Replace(" ","_") +"_"+ "Default";
foreach (string subPugString in PUGList)
{
string[] SubPugDeets = subPugString.Split(',');
if (SubPugDeets[6] == PugDeets[6])
{
PugDeets[7] += x.ToString();
x++;
}
}
string tempstring = String.Join(",", PugDeets,0,PugDeets.Count());
FinalPUGList.Add(tempstring);
}
I hope this makes some sort of sense!
I understand why this doesnt do what i want but i cant work out how to get what i'm after!