String Split function in VB.net

By: Issac Emailed: 1788 times Printed: 2623 times    

The string split function returns array of strings which are the splits of the given string it is delimited by the given System.Char array

Public Function Split (ByVal ParamArray separator () As Char) As String () 

Parameters: 
Separator - the given delimiter

Returns: 
An array of Strings delimited by one or more characters in separator

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim str As String
Dim strArr() As String
Dim count As Integer
str = "God is great"
strArr = str.Split(" ")
For count = 0 To strArr.Length - 1
MsgBox(strArr(count))
Next

End Sub
End Class


When you run this code, you will get "God" "is" "great" in separate messagebox.

Most Viewed Articles (in VB.net )

Latest Articles (in VB.net)

Comment on this tutorial