In this previous article articles about parsing files, I took a very simplistic approach to reading a delimited file. I used
string.Split, which doesn’t handle the use of quotes and usage of the delimiter character inside quotes.
Well, it turns out theres more to reading a delimited file than splitting at the delimiter… Continue reading “The trouble with delimited”
In a previous article, I described how to use LINQ when parsing a textfile.
Following that train of thoughts further, I found a more elegant way of splitting the lines from the file into columns. Creating extension methods on top of IEnumerable<string> seems like a good idea! Something that could be used like this for a comma-separated file:
from columns in reader.AsEnumerable().AsDelimited(delimiter)
Continue reading “More parsing textfiles with LINQ”
Reading and parsing files is really no difficult task with the .NET framework. The System.IO namespace has several good classes to aid that task. Continue reading “Parsing textfiles with LINQ (or LINQ-to-TextReader)”