So I am having some trouble right now. I am trying to find a way to put messages that contain the same number into an array/list with that number assuming the message has a number. An example:
11: hi 15: hello 16: whats up 14: hello 11: yo
All of these are stored in a list "commentList"
So this is how I am currently trying to do it:
List<string>[] formatList = new List<string>[22];
for (int one = 0; one < 22; one++)
{
for (int two = 11; two < 33; two++)
{
for (int three = 0; three < commentList.Count; three++)
{
if (commentList[three].Contains(two.ToString()) && formatList[one] != null)
{
formatList[one].Add(commentList[three]);
}
}
}
}
foreach (var item in formatList)
{
if (item != null)
{
foreach (var item2 in item)
{
Console.WriteLine(item2);
}
}
}
Basically, what I am going for is to have an end result where I can do something like Console.WriteLine(formatList[0]) and have it return 11: hi 11: yo