多字符拆分不起作用

时间:2016-06-27 11:05:50

标签: vb.net

我有以下字符串:

"367","90","Hey, this is a "cool" company","","","Anonymous"

我想把这个分成一个字符串数组,所以根据this solution我试过

Dim strSource As String = """367"",""90"",""Hey, this is a "cool" company"","""","""",""Anonymous"""
Dim parts As String() = strSource.Split(New String() {"", ""}, StringSplitOptions.None)

但是出现了一些错误,因为我只得到一个字符串元素,而不是我想要的六个字符串:

 1. 367
 2. 90
 3. Hey, this is a "cool" company
 4. 
 5. 
 6. Anonymous

1 个答案:

答案 0 :(得分:1)

你还没有正确地表达字符串拆分模式:

Dim strSource As String = """367"",""90"",""Hey, this is a ""cool"" company"","""","""",""Anonymous"""
Dim parts As String() = strSource.Split(New String() {""","""}, StringSplitOptions.None)