'How do I split a string on whitespace? 'by fxm ≫ Jul 20, 2025 14:17 'My inverse "join()" function: 'https://www.freebasic.net/forum/viewtopic.php?p=308295#p308295 Function Join(joins(Any) As String, ByRef s As String, ByVal skipEmptyElement As Integer = 0) As String Dim As Integer lj = LBound(joins) Dim As Integer uj = UBound(joins) If uj < lj Then Return "" Dim As Integer ls = Len(s) Dim As Integer size For i As Integer = lj To uj - 1 If Len(joins(i)) <> 0 Or skipEmptyElement = 0 Then size += Len(joins(i)) + ls Next i If Len(joins(uj)) <> 0 Or skipEmptyElement = 0 Then size += Len(joins(uj)) Dim As String so = String(size, Chr(0)) Dim As Integer n For i As Integer = lj To uj - 1 If Len(joins(i)) <> 0 Or skipEmptyElement = 0 Then fb_memcopy(so[n], joins(i)[0], Len(joins(i))) n+= Len(joins(i)) fb_memcopy(so[n], s[0], ls) n+= ls End If Next i If Len(joins(uj)) <> 0 Or skipEmptyElement = 0 Then fb_memcopy(so[n], joins(uj)[0], Len(joins(uj))) Else CPtr(Integer Ptr, @so)[1] = size - ls End If Return so End Function Dim As String Outstring Dim As String tokens(...) = {"Hello", "How", "Are", "You", "Today"} Print Join(tokens(), " ") Sleep