Programming Tutorials

String Split function in VB.net

By: Issac in VB.net Tutorials on 2009-01-30  

The Split() function in VB.net is used to split a string into an array of substrings based on a specified delimiter. Here is the syntax for the Split() function:

Split(expression, [delimiter], [count], [compare])

Here's what each parameter means:

  • expression: Required. The string to be split.
  • delimiter: Optional. The character or characters to be used as the delimiter. If not specified, the default delimiter is a space character.
  • count: Optional. The maximum number of substrings to return. If not specified, all possible substrings are returned.
  • compare: Optional. Specifies the type of comparison to use. If not specified, the binary comparison is used.

Here is an example of using the Split() function to split a string into an array:

Dim myString As String = "Hello, World!"
Dim myArray() As String
myArray = myString.Split(",")

In this example, the string "Hello, World!" is split into an array of two strings, "Hello" and " World!". The delimiter used is a comma (",") because it was specified as the first parameter of the Split() function.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in VB.net )

Latest Articles (in VB.net)