How to split string into array by delimiter and remove empty elements in VB.NET

1 Answer

0 votes
Module Module1

    Sub Main()
        Dim s As String = "VB.NET,Java,,Python,,,,"

        Dim arr() As String = s.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries)

        For Each element As String In arr
            Console.WriteLine(element)
        Next
    End Sub

End Module


' run:
' 
' VB.NET
' Java
' Python

 



answered Oct 24, 2018 by avibootz
...