Exemple #1
0
        public int DelimiterSeparatedTextParser_WithString()
        {
            var totalLength = 0;
            var parser      = new DelimiterSeparatedTextParser.CsvParser(MemoryFile);

            var numRecords = parser.RecordsLength;

            for (var recordNum = 0; recordNum < numRecords; recordNum++)
            {
                var numValues = parser.GetRecordLength(recordNum);
                for (var valueNum = 0; valueNum < numValues; valueNum++)
                {
                    var value = parser.GetValue(recordNum, valueNum).ToString();
                    totalLength += value.Length;
                }
            }

            return(totalLength);
        }
        public int DelimiterSeparatedTextParser()
        {
            var totalLength = 0;
            var parser      = new CsvParser(this.str);

            var numRecords = parser.RecordsLength;

            for (var recordNum = 0; recordNum < numRecords; recordNum++)
            {
                var numValues = parser.GetRecordLength(recordNum);
                for (var valueNum = 0; valueNum < numValues; valueNum++)
                {
                    var value = parser.GetValue(recordNum, valueNum);
                    totalLength += value.Length;
                }
            }

            return(totalLength);
        }