StringBuilder.AppendFormat
Imports System
Imports System.Text
Public Class MainClass
Shared Sub Main()
Dim s1 As String = "One,Two,Three www . java2s . com"
Const Space As Char = " "c
Const Comma As Char = ","c
Dim delimiters( ) As Char = {Space, Comma}
Dim ctr As Integer = 0
Dim resultArray As String( ) = s1.Split(delimiters)
Dim output As New StringBuilder( )
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.ToString( ))
End Sub
End Class
Related examples in the same category