Use Regx.split to split string
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class MainClass
Shared Sub Main()
Dim s1 As String = "One,Two,Three"
Dim sBuilder As New StringBuilder( )
Dim id As Integer = 1
Dim subString As String
For Each subString In Regex.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