Windows Phone Developers

Sunday, December 23, 2007

Split Function in Visual Basic .Net

Split Function returns a zero-based, one-dimensional array containing a specified number of substrings.

Function DND_Split_Example()

Dim arTempVB2005() As String

Dim arTempVB6() As String

Dim arTempSpace() As String

Dim sSplitString As String

sSplitString = "MyName||MyAge||MySex"

arTempVB2005 = sSplitString.Split("||")

arTempVB6 = Microsoft.VisualBasic.Split(sSplitString, "||")

arTempSpace = Split("Split By Spaces”)

End Function





Here are the overloaded examples of Split Function


Split Call

Return Value

Split("42, 12, 19")

{"42," , "12," , "19"}

Split("42, 12, 19", ", ")

{"42", "12", "19"}

Split("42, 12, 19", ", ", 2)

{"42", "12, 19"}

Split("192.168.0.1", ".")

{"192", "168", "0", "1"}

Split("Alice and Bob", " AND ")

{"Alice and Bob"}

Split("Alice and Bob", " AND ", ,CompareMethod.Text)

{"Alice", "Bob"}

Split("someone@example.com", "@",1)

{"someone@example.com"}

Split("someone@example.com", "@",2)

{"someone", "example.com"}



Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

2 comments:

  1. Hi..

    I have created a command button dynamically as under

    Dim C1 As CommandButton
    Form1.Controls.Add "VB.commandbutton", "C1", Form1
    With Form1!C1
    .Visible = True
    .Caption = "Find Square Root"
    .Width = 2000
    .Top = 3700
    .Left = 1000
    End With

    Now I want to add click event to this button.

    How can I?

    Vijaykumar Dave
    vijaykumardave@gmail.com

    ReplyDelete
  2. Handling .NET Events with WithEvents

    Can you try the following:

    http://www.developerfusion.com/samplechapter/4375/building-windows-applications/3/

    ReplyDelete