主要解决CSV字段数据带有双引号的问题
具体代码如下
Public Function ChangeCsvSplitLine(ByVal strLine As String ByVal iColNumber As Integer) As String()
Dim strList() As String = strLineSplit()
If strListLength = iColNumber Then
Return strList
End If
Dim i As Integer =
Dim findSplitIndex As Integer =
Dim index As Integer =
Dim returnList(iColNumber) As String
Dim strMerger As String =
For i = To strListLength
If findSplitIndex = Then
If (strList(i)() = And strList(i)(strList(i)Length ) <> ) _
Or (strList(i)Length = And strList(i) = ) Then
findSplitIndex = i
Else
returnList(index) = strList(i)
index = index +
End If
Else
If (strList(i)() <> And strList(i)(strList(i)Length ) = ) _
Or (strList(i)Length = And strList(i) = ) Then
strMerger =
For findSplitIndex = findSplitIndex To i
strMerger = strMerger & strList(findSplitIndex) &
Next
strMerger = strMergerSubstring( strMergerLength )
returnList(index) = strMerger
index = index +
findSplitIndex =
End If
End If
Next
Return returnList
End Function