如何解決CSV字段數據的雙引號問題_.Net教程
推薦:解析.NET FileStreams如何將DTD插入XML文件中.NET類則更加方便,它會帶給你更多使用上的靈活性。 技術工具箱: VB.NET, XML, ADO.NET ADO.NET提供了一種很好的功能來處理dataset和XML之間的轉換。你可以通過VS.NET在XML中形象地創
如何解決CSV字段數據的雙引號問題,主要解決CSV字段數據帶有雙引號的問題
具體代碼如下:
以下為引用的內容:
Public Function ChangeCsvSplitLine(ByVal strLine As String, ByVal iColNumber As Integer) As String()
Dim strList() As String = strLine.Split(",")
If strList.Length = iColNumber Then
Return strList
End If
Dim i As Integer = 0
Dim findSplitIndex As Integer = -1
Dim index As Integer = 0
Dim returnList(iColNumber) As String
Dim strMerger As String = ""
For i = 0 To strList.Length - 1
If findSplitIndex = -1 Then
If (strList(i)(0) = """" And strList(i)(strList(i).Length - 1) <> """") _
Or (strList(i).Length = 1 And strList(i) = """") Then
findSplitIndex = i
Else
returnList(index) = strList(i)
index = index 1
End If
Else
If (strList(i)(0) <> """" And strList(i)(strList(i).Length - 1) = """") _
Or (strList(i).Length = 1 And strList(i) = """") Then
strMerger = ""
For findSplitIndex = findSplitIndex To i
strMerger = strMerger & strList(findSplitIndex) & ","
Next
strMerger = strMerger.Substring(0, strMerger.Length - 1)
returnList(index) = strMerger
index = index 1
findSplitIndex = -1
End If
End If
Next
Return returnList
End Function
分享: 解析VB.NET中的常量與枚舉功能在程序運行的過程中始終固定不變的量稱為常量。由于在程序設計和開發時經常會反復地運用一些常數,而且它們代表的含義有時候非常難記,所以每次都需要去核對,如果定義了常量將使之簡單化
- asp.net如何得到GRIDVIEW中某行某列值的方法
- .net SMTP發送Email實例(可帶附件)
- js實現廣告漂浮效果的小例子
- asp.net Repeater 數據綁定的具體實現
- Asp.Net 無刷新文件上傳并顯示進度條的實現方法及思路
- Asp.net獲取客戶端IP常見代碼存在的偽造IP問題探討
- VS2010 水晶報表的使用方法
- ASP.NET中操作SQL數據庫(連接字符串的配置及獲取)
- asp.net頁面傳值測試實例代碼
- DataGridView - DataGridViewCheckBoxCell的使用介紹
- asp.net中javascript的引用(直接引入和間接引入)
- 三層+存儲過程實現分頁示例代碼
- 相關鏈接:
- 教程說明:
.Net教程-如何解決CSV字段數據的雙引號問題
。