--- a/docs/Writerside/topics/string.h.md Sat Feb 22 18:55:25 2025 +0100 +++ b/docs/Writerside/topics/string.h.md Sun Feb 23 13:11:46 2025 +0100 @@ -220,8 +220,22 @@ size_t limit, cxmutstr **output); ``` -> Documentation work in progress. ->{style="warning"} +The `cx_strsplit()` function splits the input `string` using the specified delimiter `delim` +and writes the substrings into the pre-allocated `output` array. +The maximum number of resulting strings can be specified with `limit`. +That means, at most `limit-1` splits are performed. +The function returns the actual number of items written to `output`. + +On the other hand, `cx_strsplit_a()` uses the specified `allocator` to allocate the output array, +and writes the pointer to the allocated memory to `output`. + +The functions `cx_strsplit_m()` and `cx_strsplit_ma()` are equivalent to `cx_strsplit()` and `cx_strsplit_a()`, +except that they work on `cxmustr` instead of `cxstring`. + +> The `allocator` in `cx_strsplit_a()` and `cx_strsplit_ma()` is _only_ used to allocate the output array. +> The strings will always point into the original `string` +> and you need to use `cx_strdup()` or `cx_strdup_a()` if you want copies or zero-terminated strings after performing the split. +{style="note"} ## Complex Tokenization