Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Class Tester
Public Shared Sub Main( )
Dim s1 As String = "One,Two,Three Four"
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)
End Sub
End Class
|