-
Im using Split to parse a string with a statment like:
Code:
Dim X As Variant
X = Split(InputData$, "|")
Does anyone know how to see how many fields that Split created because if I try to MsgBox X(99) but the string only contained 98 fields, I get an error, how can I see how many fields it created in X?
-
Use UBound() to get the highest index.
Code:
Retval = Split("One|Two|Three|Four", "|")
For I = 0 To UBound(Retval)
Print Retval(I)
Next I
-
Code:
'PURPOSE:Break up string basing on " " and stick into an array
Dim str_Split() As String
str_Split = Split("How | Are | You", "|")
MsgBox "There are " & UBound(str_Split) & " occurence."
Dim int_X As Integer
Dim str_Data As String
For int_X = LBound(str_Split) To UBound(str_Split)
str_Data = str_Data & vbCrLf & str_Split(int_X)
Next
MsgBox str_Data
-
Code:
Count = ubound(split("A|B|C","|")) + 1