Windows Phone Developers

Showing posts with label Split Function Examples. Show all posts
Showing posts with label Split Function Examples. Show all posts

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