02-13-2023, 10:31 AM
A Handy piece of code that will split a string into an array.
Code: (Select All)
Sub StringSplitter (ST As String, AR() As String, DL As String)
Dim Delim(Len(DL)) As String
For i = 1 To Len(DL)
Delim(i) = Mid$(DL, i, 1)
Next
c = 1
Do
For i = 1 To UBound(Delim)
If Mid$(ST, c, 1) = Delim(i) Then
ReDim _Preserve AR(UBound(AR) + 1)
c = c + 1
Exit For
End If
Next i
AR(UBound(AR)) = AR(UBound(AR)) + Mid$(ST, c, 1)
c = c + 1
Loop Until c > Len(ST)
End Sub