This is a REAL STRING PARSER. split string with more than one split character
This is a REAL STRING PARSER. split string with more than one split character
API Declarations
Dim Data() As String
'For Module usage:
'Public Data() As String
Rate This is a REAL STRING PARSER. split string with more than one split character
(2(2 Vote))
'decode("test,test3,testttt",",")
'msgbox data(0) = "test" -True
'msgbox data(1) = "teset3" -True
'msgbox data(2) = "testttt" -True
''''''''''''''''''''''''''''''''''''''''''''
Sub decode(ByVal inpt As String, ByVal splitChar As String)
If Right(inpt, 1) <> splitChar Then 'If there isn't a splitChar at end of
inpt = inpt & splitChar 'string then Add ONE
End If
For i = 1 To InStrRev(inpt, splitChar) 'Calculate the number of splitChar's
If Mid(inpt, i, 1) = splitChar Then 'so we can reDim Data()
z = z + 1
End If
Next i
ReDim Data(z - 1)
For i = 1 To Len(inpt) 'Start splitting temporary string into the real
crntchr = Mid(inpt, i, 1) 'Data() string array
If crntchr <> splitChar Then
temp = temp & crntchr 'Yeah its only one byte at a time, its still
ElseIf crntchr = splitChar Then 'usefull
x = x + 1
Data(x - 1) = temp 'x-1 so we dont waste any space
temp = "" 'Clear temporary string
End If
Next i 'and reiterate
End Sub
This is a REAL STRING PARSER. split string with more than one split character Comments
No comments yet — be the first to post one!
Post a Comment