String.Split Method (Char[], Int32) : String Split « Data Types « VB.Net






String.Split Method (Char[], Int32)

  

Public Class StringSplit2
   Public Shared Sub Main()

      Dim delimStr As String = " ,.:"
      Dim delimiter As Char() = delimStr.ToCharArray()
      Dim words As String = "one two,three:four."
      Dim split As String() = Nothing

      Console.WriteLine("The delimiters are -{0}-", delimStr)
      Dim x As Integer
      For x = 1 To 5
         split = words.Split(delimiter, x)
         Console.WriteLine(x)
         Dim s As String
         For Each s In  split
            Console.WriteLine("-{0}-", s)
         Next s
      Next x
   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, StringSplitOptions)
5.Split a string delimited by characters and return all elements
6.Split a string delimited by characters and return all non-empty elements
7.Split string into string and empty string
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)