[AccessD] Turn a string into an array

Stuart McLachlan stuart at lexacorp.com.pg
Thu Aug 19 15:43:46 CDT 2021


A handy little trick  for debugging to replace your multi-line For...Next loop :)

Debug.Print Join(Elements(), vbLf)
or
Msgbox  Join(Elements(), vbLf)


On 19 Aug 2021 at 12:37, Gustav Brock via AccessD wrote:

 Try this demo:
> 
> <code>
> Public Sub ArrayDemo()
> 
>     Const Sample    As String = "123, 456,  789"
> 
>     Dim Elements()  As String
>     Dim Index       As Integer
> 
>     Elements = Split(Sample, ",")
> 
>     For Index = LBound(Elements) To UBound(Elements)
>         Debug.Print Elements(Index),
>         Elements(Index) = Trim(Elements(Index))
>         Debug.Print Elements(Index)
>     Next
> 
> End Sub
> </code>
> 



More information about the AccessD mailing list