private void mergeEqualRows() { List<DirectorsTableRow> newList = new List<DirectorsTableRow>(); DirectorsTableRow row = new DirectorsTableRow(rows[0]); for (int i = 1; i < rows.Count; i++) { if (rows[i].CompareTo(rows[i - 1]) != 0) { newList.Add(row); row = new DirectorsTableRow(rows[i]); } } newList.Add(row); rows = newList; }
private DirectorsTableRow parseDirectorLine(string[] tokens) { DirectorsTableRow row = new DirectorsTableRow(); row.Director = tokens[0]; Regex date = new Regex(@"\s+\([1-2]\d{3}[\)\\\/]"); row.FilmTitle = date.Split(tokens[1])[0].Trim(); MatchCollection collection = date.Matches(tokens[1]); if (collection.Count > 0) { string temp = collection[0].Value.Trim(); temp = temp.Substring(1, 4); int year; int.TryParse(temp, out year); row.Year = year; } return row; }