示例#1
0
 internal static void ComparisonEngine(string csvFieldData)
 {
     List <string> gasStationList      = ListFactory.GasStationList();
     List <string> departmentStoreList = ListFactory.DepartmentStoreList();
     List <string> groceryStoreList    = ListFactory.GroceryStoreList();
     List <string> shippingStoreList   = ListFactory.ShippingStoreList();
 }
示例#2
0
        /// <summary>
        /// The parsing engine.
        /// </summary>
        /// <param name="path">The string value for the path to the csv file on disk.</param>
        /// <returns>A list of csv line data.</returns>
        public static List <string> ParseEngine(string path)
        {
            List <string> gasStationList      = ListFactory.GasStationList();
            List <string> departmentStoreList = ListFactory.DepartmentStoreList();
            List <string> groceryStoreList    = ListFactory.GroceryStoreList();
            List <string> shippingStoreList   = ListFactory.ShippingStoreList();

            using (TextFieldParser parser = new TextFieldParser(path))
            {
                List <string> lineBuilder = new List <string>();
                List <string> lineStorer  = new List <string>();

                parser.TextFieldType = FieldType.Delimited;
                parser.SetDelimiters(",");
                while (!parser.EndOfData)
                {
                    //Process row
                    string[] fields = parser.ReadFields();
                    foreach (string field in fields)
                    {
                        Console.WriteLine(field);
                        Console.ReadLine();
                    }

                    string line = String.Join(" ", fields);
                    Console.WriteLine(line);
                    Console.ReadLine();
                    string correctedLine = Regex.Replace(line, " {2,}", " ");

                    Console.WriteLine(correctedLine);
                    Console.ReadLine();
                }
                return(lineStorer);
            }
        }