I am solving a problem in Volleyball. In volleyball sport we have five sets per match.
string[] arrMatchSummary = fromDict.matchsummary.SafeSplit(' ');
string firstSet = arrMatchSummary[0];
string firstSetResult = firstSet.Replace('-', ':');
string secondSet = arrMatchSummary[1];
string secondSetResult = secondSet.Replace('-', ':');
string thirdSet = arrMatchSummary[2];
string thirdSetResult = thirdSet.Replace('-', ':');
string fourthSet = arrMatchSummary[3];
string fourthSetResult = fourthSet.Replace('-', ':');
In arrMatchSummary i have 5 items in array like "25:18" etc.
When match has not started, this line is giving me index out of range exception:
string secondSet = arrMatchSummary[1];
because, when it is not started, there are no second set.
My question is:
Everything works in code, how to SKIP this index out of range and continue so that the program could work?
Thanks.