' splitw() test. support WString ' Last updated: <2024/02/16 04:03:49 +0900> Dim As WString * 1024 text, delim text = "新しい 朝が来た 希望の 朝だ" delim = " " Dim result(256) As WString * 256 ' max 256 length x 256 ' ---------------------------------------- #macro splitW( s, d, a ) Dim As WString * 1024 src = s Dim As Integer n = 0 Do Dim As Integer i = InStr(1, src, WChr(d[0])) ' search delimiter If i = 0 Then ' not found delimiter. exit Loop If src <> "" Then a(n) = src n += 1 End If Exit Do End If Dim As WString * 256 word word = Left(src, i - 1) If word <> "" Then a(n) = word ' save word to Array n += 1 End If src = Mid(src, i + 1) ' delete word Loop #endmacro ' ---------------------------------------- splitW(text, delim, result) Print "[" & text & "]" For i As Integer = 0 To UBound(result) If result(i) = "" Then Exit For Print i & ": [" & result(i) & "]" Next i Print "end."