2

I'm using the CsvReader library in my Windows Forms application, which is coded in horribly messy VB (I've recently taken over the project.)

I'm currently capable of reading semi-colon separated files without quoting, but I'm having a problem: most of the input has quoted fields, but includes unescaped quote characters within the fields.

I cannot change the input, so I must tackle it somehow. One solution would be to entirely disable quoting -- but I'm not quite sure how to do that...

Any help would be appreciated!

4

3 回答 3

2

我只玩过这个库LINQtoCSV,但我认为它可能对引用的字段有所帮助。

于 2008-10-22T13:29:05.067 回答
1

查看FileHelpers

于 2008-10-22T13:45:43.223 回答
0

你需要它有多通用?编写自己的 CSV 解析器将数据读入 DataTable 非常简单。

在某些情况下,解析 csv 文件可以像执行 a 一样简单File.ReadAllLines(filename),然后对每一行执行 a,string.Split使用分号作为分隔符来获取列。您的代码可能会比这更高级,但如果您有特定的需求,自己编写它可能是一个好主意。

于 2008-10-22T13:44:42.523 回答