Thu, 30 Oct 2025 19:27:18 +0100
fix typo bug in cxListDifference() - resolves #745
| 1141 | 1 | # Strings and Buffers | 
| 1208 
6e78f45b17c3
add link summary text to strings and buffers topic
 Mike Becker <universe@uap-core.de> parents: 
1141diff
changeset | 2 | |
| 
6e78f45b17c3
add link summary text to strings and buffers topic
 Mike Becker <universe@uap-core.de> parents: 
1141diff
changeset | 3 | For an improved experience when working with strings, | 
| 
6e78f45b17c3
add link summary text to strings and buffers topic
 Mike Becker <universe@uap-core.de> parents: 
1141diff
changeset | 4 | UCX provides an API to work with structures that store a [string](string.h.md) together with its length, | 
| 
6e78f45b17c3
add link summary text to strings and buffers topic
 Mike Becker <universe@uap-core.de> parents: 
1141diff
changeset | 5 | as well as a more sophisticated [buffer](buffer.h.md) API for working with text of dynamic or unknown length. | 
| 
6e78f45b17c3
add link summary text to strings and buffers topic
 Mike Becker <universe@uap-core.de> parents: 
1141diff
changeset | 6 | |
| 1424 
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
 Mike Becker <universe@uap-core.de> parents: 
1209diff
changeset | 7 | Additionally, UCX offers several advanced [printf-like functions](printf.h.md) that also allow convenient work | 
| 1209 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 8 | with strings of unknown length. | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 9 | For example, one the more advanced functions is `cx_sprintf_sa()` which lets you format a string into an existing | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 10 | pre-allocated buffer (e.g. on the stack) and automatically switches to a fresh buffer allocated by a custom allocator | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 11 | when the existing buffer is not large enough. | 
| 1208 
6e78f45b17c3
add link summary text to strings and buffers topic
 Mike Becker <universe@uap-core.de> parents: 
1141diff
changeset | 12 | |
| 1209 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 13 | The string API is designed to work with _both_ mutable and constant strings. | 
| 1424 
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
 Mike Becker <universe@uap-core.de> parents: 
1209diff
changeset | 14 | The possibility to work with constant strings is especially important when you want to work with string literals | 
| 
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
 Mike Becker <universe@uap-core.de> parents: 
1209diff
changeset | 15 | without copying them into a separate memory region - e.g., when you want to get a substring. | 
| 1209 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 16 | |
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 17 | By default, UCX assumes strings are constant and stores them in a structure of type `cxstring`. | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 18 | Mutable strings are stored in a separate structure called `cxmutstr`. | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 19 | You can conveniently convert any UCX string to a `cxstring` by using `cx_strcast()`. | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 20 | Several macros throughout UCX already do that for you. | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 21 | Since this function is usually inlined, this comes with no additional cost when compiled with optimizations enabled. | 
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 22 | |
| 
4a72c47226f4
complete description for strings and buffers
 Mike Becker <universe@uap-core.de> parents: 
1208diff
changeset | 23 |