static public int GamesWon(string Scores) { int TotalWon = 0; string[] Sets_ = Scores.Split(','); foreach (string CurSet in Sets_) { string[] WinLoss = CurSet.Split('–'); if (WinLoss.Count() == 2) { TotalWon += Convert.ToInt16(WinLoss[0]); } } return(TotalWon); }
static public int GamesLost(string Scores) { int TotalLost = 0; string[] Sets_ = Scores.Split(','); foreach (string CurSet in Sets_) { string[] WinLoss = CurSet.Split('–'); if (WinLoss.Count() == 2) { // Deal with tiebreakers int x = WinLoss[1].IndexOf("("); if (x > 0) { WinLoss[1] = WinLoss[1].Substring(0, x - 1); } TotalLost += Convert.ToInt16(WinLoss[1]); } } return(TotalLost); }