StringSplitOptions.RemoveEmptyEntries
Imports System
Class Sample
Public Shared Sub Main()
Dim s1 As String = ",A,,B,,,C,,"
Dim charSeparators() As Char = {","c}
Dim result As String() = s1.Split(charSeparators, 2, StringSplitOptions.RemoveEmptyEntries)
Show(result)
End Sub 'Main
Public Shared Sub Show(ByVal entries() As String)
Console.WriteLine(entries.Length)
Dim entry As String
For Each entry In entries
Console.WriteLine(entry)
Next entry
End Sub
End Class
Related examples in the same category