Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class MainClass
Shared Sub Main(ByVal args As String())
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)
End Sub
End Class
|