' split String. exclude empty strings ' Last updated: <2024/02/16 03:32:52 +0900> ' ' Passing Arrays to Procedures - FreeBASIC Wiki Manual | FBWiki ' https://www.freebasic.net/wiki/ProPgPassingArrays ' https://makoto-watanabe.main.jp/freebasic/ProPgPassingArrays.html #ifndef __SPLITSTRINGB2__ #define __SPLITSTRINGB2__ Sub splitStringB2(ByVal src As String, ByVal delim As String, result(Any) As String) Do Dim As Integer i = InStr(1, src, Chr(delim[0])) ' search delimiter If i = 0 Then ' not found delimiter. exit loop ReDim Preserve result(UBound(result) + 1) result(UBound(result)) = src Exit Do End If Dim As String word = Left(src, i - 1) If word <> "" Then ReDim Preserve result(UBound(result) + 1) result(UBound(result)) = word ' save word to array End If src = Mid(src, i + 1) ' delete word Loop End Sub #endif