熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

解決CSV字段數據帶有雙引號的問題

2013-11-13 12:13:56  來源: .NET編程 

  主要解決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

 

 


From:http://tw.wingwit.com/Article/program/net/201311/15450.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.