1

VB2005。因此,只需进行一些测试并在使用 TextFieldParser http://connect.microsoft.com/VisualStudio/feedback/details/679596/textfieldparser-does-not-respect-consecutive-line-breaks-解析我的 CSV 数据时遇到了这个奇怪的问题in-the-middle-of-a-field无法识别字段中重复的换行符。请注意,这与跳过空白字段不同。无论如何,我正在测试另一种获取数据的方法。我正在尝试普通的旧拆分函数,但该函数无法处理像 TextFieldParser 这样的字段中的嵌入逗号。有没有解决这个问题的方法?

例如,源数据字段读取:

"this is line 1
this is line 2

this is line 3


this is line 4
this is line 5"

在我用 TextFieldParser 解析它之后,我得到一个输出:

this is line 1
this is line 2
this is line 3
this is line 4
this is line 5

似乎任何空白行都会被忽略。如果我有一个包含多个段落的备忘录,这将把它们混在一起,中间没有空格。还有其他人看到这种行为吗?

更新:使用来自 Code 项目http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader的 CSV 阅读器,效果很好。不修剪空行上的内部换行符。

4

0 回答 0