' split String ' Last updated: <2024/02/16 03:32:21 +0900> ' ' Split the string into substrings using delimiter - GeeksforGeeks ' https://www.geeksforgeeks.org/split-string-substrings-using-delimiter/ #ifndef __SPLITSTRINGA__ #define __SPLITSTRINGA__ Sub splitStringA(ByVal text As String, ByVal delim As String, result() as String, ByVal chk_dbqt As Boolean = False) If text = "" Then Return Dim As String src = text & delim Dim As String word = "" Dim As Boolean exist_dbqt = False For i As Integer = 0 To Len(src) - 1 If exist_dbqt Then word &= Chr(src[i]) If src[i] = 34 Then exist_dbqt = False ' found double quote Else If src[i] <> delim[0] Then ' not delimiter word &= Chr(src[i]) If chk_dbqt And src[i] = 34 Then exist_dbqt = True ' found double quote Else ' found delimiter If word <> "" Then ' word is not empty. save word to array ReDim preserve result(UBound(result) + 1) result(UBound(result)) = word word = "" End If End If End If Next i If word <> "" Then ' word is not empty. save word to array ReDim preserve result(UBound(result) + 1) result(UBound(result)) = word End If End Sub #endif