Imports System
Imports System.Text
Public Class MainClass
Shared Sub Main(ByVal args As String())
Dim s1 As String = "One,Two,Three"
Const Space As Char = " "c
Const Comma As Char = ","c
Dim delimiters( ) As Char = {Space, Comma}
Dim output As New StringBuilder( )
Dim ctr As Integer = 0
Dim resultArray As String( ) = s1.Split(delimiters)
Dim subString As String
For Each subString In resultArray
ctr = ctr + 1
output.AppendFormat("{0} : {1}" & _
Environment.NewLine, ctr, subString)
Next subString
Console.WriteLine(output)
End Sub
End Class
|