Split string into string and empty string : String Split « Data Types « VB.Net






Split string into string and empty string

  

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.None)
        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

1.String SplitString Split
2.Split by ControlChars.Tab
3.String.Split Method (Char[])
4.String.Split Method (Char[], Int32)
5.String.Split Method (Char[], Int32, StringSplitOptions)
6.Split a string delimited by characters and return all elements
7.Split a string delimited by characters and return all non-empty elements
8.StringSplitOptions.RemoveEmptyEntries
9.Split a string delimited by another string and return all elements
10.Split the original string at the delimiter and return all non-empty elements
11.String.Split (Char[], StringSplitOptions) (System)_VB.htm
12.Split with string arrays
13.String.Split (String[], StringSplitOptions)