write section in string docu about comparisons and concatenation default tip

Thu, 20 Feb 2025 21:21:25 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 20 Feb 2025 21:21:25 +0100
changeset 1219
9c1c33ac077a
parent 1218
cbb48edaf433

write section in string docu about comparisons and concatenation

relates to #451

docs/Writerside/topics/string.h.md file | annotate | diff | comparison | revisions
--- a/docs/Writerside/topics/string.h.md	Thu Feb 20 20:49:04 2025 +0100
+++ b/docs/Writerside/topics/string.h.md	Thu Feb 20 21:21:25 2025 +0100
@@ -84,8 +84,17 @@
 bool cx_strcasesuffix(cxstring string, cxstring suffix);
 ```
 
-> Documentation work in progress.
->{style="warning"}
+The `cx_strcmp()` function compares two UCX strings lexicographically
+and returns an integer greater than, equal to, or less than 0, if `s1` is greater than, equal to, or less than `s2`, respectively.
+The `cx_strcmp_p()` function is equivalent, except that it takes pointers to the UCX strings and the signature is compatible with `cx_compare_func`.
+
+The functions `cx_strprefix()` and `cx_strsuffic()` check if `string` starts with `prefix` or ends with `suffix`, respectively.
+
+The functions `cx_strcasecmp()`, `cx_strcasecmp_p()`, `cx_strcaseprefix()`, and `cx_strcasesuffix()` are equivalent,
+except that they compare the strings case-insensitive.
+
+> In the current version of UCX, case-insensitive comparisons are only guaranteed to work with ASCII characters.
+{style="note"}
 
 ## Concatenation
 
@@ -104,8 +113,22 @@
 size_t cx_strlen(size_t count, ...);
 ```
 
-> Documentation work in progress.
->{style="warning"}
+The `cx_strcat_a()` function takes `count` UCX strings,
+allocates memory for a concatenation of those strings _with a single allocation_,
+and copies the contents of the strings to the new memory.
+`cx_strcat()` is equivalent, except that is uses the default stdlib allocator.
+
+The `cx_strcat_ma()` and `cx_strcat_m()` append the `count` strings to the specified string `str` and,
+instead of allocating new memory, reallocate the existing memory in `str`.
+If the pointer in `str` is `NULL`, there is no difference to `cx_strcat_a()`.
+Note, that `count` always denotes the number of variadic arguments in _both_ variants.
+
+The function `cx_strlen()` sums the length of the specified strings.
+
+> There is no reason to use `cx_strlen()` for a single UCX string.
+> Just access the `length` field of the structure directly. 
+
+> You can mix `cxstring` and `cxmutstr` in the variadic arguments without the need of `cx_strcast()`.
 
 ## Find Characters and Substrings
 

mercurial