【发布时间】:2014-11-07 00:05:15
【问题描述】:
我在 vb.net 中使用此代码读取 csv 文件:
filename = TextBox1.Text
FileOpen(1, filename, OpenMode.Input)
'first row contains header information, therefore read it in, but ignore it
dummy = LineInput(1)
While Not EOF(1)
Input(1, dialcode)
Input(1, chargecode)
Input(1, description)
Input(1, mincharge)
Input(1, onpeak)
Input(1, offpeak)
Input(1, weekendonpeak)
Input(1, weekendoffpeak)
Input(1, onpeakconnect)
Input(1, offpeakconnect)
Input(1, weekendonpeakconnect)
Input(1, weekendoffpeakconnect)
End While
这很好
但是我现在有一个不同的 CSV 文件要读入,当我在记事本中打开 CSV 文件时,它在每一行的末尾都有一个 ,,所以它不会读取每一行,因为 vb.net 不确定一行结束
【问题讨论】:
-
您“使用此代码”还是“编写此代码”?
-
编写并使用它(:
-
您为什么不直接阅读并丢弃该行的其余部分?