Ejemplo n.º 1
0
        public CSVLine(string[] src)
        {
#if DEBUG
            if (null == src || 1 > src.Length)
            {
                throw new ArgumentNullException(nameof(src));
            }
#endif
            m_Fields = new CSVField[src.Length];
            int i = src.Length;
            while (0 <= --i)
            {
                m_Fields[i] = new CSVField(src[i]);
            }
        }
        public CSVTable ParseToTable(string[] lines, int nbFields)
        {
            CSVTable table = new CSVTable(nbFields);

            List <string[]> parsedRawLines = Parse(lines);

            foreach (string[] l in parsedRawLines)
            {
                CSVLine newTableLine = new CSVLine(l.Length);
                for (int iField = 0; iField < newTableLine.FieldsCount; iField++)
                {
                    newTableLine[iField] = new CSVField(l[iField]);
                }

                table.AddLine(newTableLine);
            }

            return(table);
        }