Visual Basic String Function : Split
purpose : Split examines an expression and parses out substrings based on a specified delimiter.The substrings that are parsed out are placed into a zero-based array.
Syntax :
Split ( expression [ , delimiter [ , count [ , compare ] ] ] )
expression : String value to be processed.
delimiter : String value identifying one substring from another. If this value is omitted, a blank space ( " " ) is used a s the delimiter.
count : Indicator how many time through the expression the function loops . if this value is omitted, the entire expression is processed.
compare : Indicator for the type of comparison between the delimiter and the expression.
0 : vbBinaryCompare
1 : vbTextCompare
2 : vbDatabasecompare
Split ( expression [ , delimiter [ , count [ , compare ] ] ] )
expression : String value to be processed.
delimiter : String value identifying one substring from another. If this value is omitted, a blank space ( " " ) is used a s the delimiter.
count : Indicator how many time through the expression the function loops . if this value is omitted, the entire expression is processed.
compare : Indicator for the type of comparison between the delimiter and the expression.
0 : vbBinaryCompare
1 : vbTextCompare
2 : vbDatabasecompare
sName = Split ( "Mr. Arvind Nahar")
the result of the Split function crates a one-dimensional array in sName, where
sName(0) = "Mr."
sName(1) = "Arvind"
sName(2) = "Nahar"
the result of the Split function crates a one-dimensional array in sName, where
sName(0) = "Mr."
sName(1) = "Arvind"
sName(2) = "Nahar"
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
Dim sName() As String
Dim str As String
str = Text1.Text
sName = Split(str, ",")
For i = 0 To UBound(sName)
List1.AddItem sName(i)
Next i
End Sub
Private Sub Command1_Click()
Dim i As Integer
Dim sName() As String
Dim str As String
str = Text1.Text
sName = Split(str, ",")
For i = 0 To UBound(sName)
List1.AddItem sName(i)
Next i
End Sub
No comments:
Post a Comment