+92 332 4229 857 99ProjectIdeas@Gmail.com

String.Split function (Vb.net)


String Split function
String.Split() function separates the input string into words on the basis of separator parameter.
System.String is the library for this function.
 
Example
Dim str As String = "my name is Saad Bin Saulat"
Dim strArr() As String
Dim count As Integer = 0
Dim strArrLength As Integer = 0
strArr = str.Split(" ")
strArrLength = strArr.Length

     For count = 0 To strArrLength - 1
      MsgBox(strArr(count))
     Next
Result
This function will separate the string "my name is Saad Bin Saulat" into words on the basis of the input separator character. In this example the separator parameter is the space. So the loop will display: 
my
name
is
Saad
Bin
Saulat

strArr() will contains :
strArr(0) = my
strArr(1) = name
strArr(2) = is
strArr(3) = Saad
strArr(4) = Bin
strArr(5) = Saulat


Related articles

0 comments: