ruedi ruedi - 5 months ago 9
Vb.net Question

Multi-Character Split does not work

I have the following string:

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


I want to get this separted into a string array so according to this solution I tried

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


but something seems wrong since I get only one string element instead of six I want to:

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

Answer

You haven't phrased the string split pattern correctly:

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