Use Regex to separate strings
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class MainClass
Shared Sub Main()
Dim s1 As String = "One,Two,Three"
Dim theRegex As New Regex(" |, |,")
Dim sBuilder As New StringBuilder( )
Dim id As Integer = 1
Dim subString As String
For Each subString In theRegex.Split(s1)
id = id + 1
sBuilder.AppendFormat("{0}: {1}" _
& Environment.NewLine, id, subString)
Next subString
Console.WriteLine("{0}", sBuilder.ToString( ))
End Sub
End Class
Related examples in the same category