java下载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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值