Performs a function similar to split in Perl
Performs a function similar to "split" in Perl
API Declarations
' array [Params()], but it can be used for many other applications.
Rate Performs a function similar to split in Perl
(1(1 Vote))
Dim Params() As String
Dim Temp As String
Dim i, NumParams As Integer
'This allows the original string to remain in tact
Temp = Command 'Where Command is the string you want to break up
NumParams = 0
Do
' Replace " " with the character to split on (for CSV, it would be ",")
i = InStr(1, Temp, " ")
ReDim Preserve Params(NumParams)
If i Then
Params(NumParams) = Left(Temp, i - 1)
Temp = Right(Temp, Len(Temp) - i)
NumParams = NumParams + 1
Else
Params(NumParams) = Temp
End If
Loop While i
' NumParams in now the number of parameters in you're array.
Performs a function similar to split in Perl Comments
No comments yet — be the first to post one!
Post a Comment