Posted by Anonymous on Mon 25 Aug 12:39
report abuse | download | new post
- using System;
- using System.Text.RegularExpressions;
- using System.Data;
- using System.Collections;
- namespace retest
- {
- class Program
- {
- static void Main(string[] args)
- {
- String fileContent = sr.ReadToEnd();
- sr.Close();
- String cp = @"\s+(-?[\d.]+)";
- MatchCollection mc = re.Matches(fileContent);
- foreach (Match m in mc)
- {
- table.Rows.Add(new object[] { m.Groups[1].Value, m.Groups[2].Value, m.Groups[3].Value, m.Groups[4].Value, m.Groups[5].Value, m.Groups[6].Value, m.Groups[7].Value, m.Groups[8].Value, m.Groups[9].Value, m.Groups[0].Value});
- }
- table.AcceptChanges();
- DataRow[] allRows;
- allRows = table.Select();
- DataRow[] foundRows;
- for (int ii = 0; ii < allRows.Length; ii++)
- {
- if (!list.Contains(allRows[ii]["Code"]))
- {
- list.Add(allRows[ii]["Code"]);
- string expression = "Code = '" + allRows[ii]["Code"] + "'";
- foundRows = table.Select(expression);
- if (foundRows.Length == 2)
- {
- Console.WriteLine(expression + ":");
- Console.WriteLine("row 0:");
- Console.WriteLine(foundRows[0]["Code"] + "," + foundRows[0]["Open"] + "," + foundRows[0]["High"] + "," + foundRows[0]["Low"] + "," + foundRows[0]["Close"] + "," + foundRows[0]["Change"] + "," + foundRows[0]["Trade"] + "," + foundRows[0]["Volume"] + "," + foundRows[0]["Value"] + "," + foundRows[0]["Line"]);
- Console.WriteLine("row 1:");
- Console.WriteLine(foundRows[1]["Code"] + "," + foundRows[1]["Open"] + "," + foundRows[1]["High"] + "," + foundRows[1]["Low"] + "," + foundRows[1]["Close"] + "," + foundRows[1]["Change"] + "," + foundRows[1]["Trade"] + "," + foundRows[1]["Volume"] + "," + foundRows[1]["Value"] + "," + foundRows[1]["Line"]);
- Console.WriteLine("===================");
- }
- }
- }
- }
- }
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.