docs/Writerside/topics/string.h.md

changeset 1334
7763892ed801
parent 1331
02946dc73e6a
child 1424
563033aa998c
equal deleted inserted replaced
1333:2fc1c25441f1 1334:7763892ed801
51 #define CX_PRIstr ".*s" 51 #define CX_PRIstr ".*s"
52 #define cx_strcast(s) // converts any string to cxstring 52 #define cx_strcast(s) // converts any string to cxstring
53 ``` 53 ```
54 54
55 The functions `cx_str()` and `cx_mutstr()` create a UCX string from a `const char*` or a `char*` 55 The functions `cx_str()` and `cx_mutstr()` create a UCX string from a `const char*` or a `char*`
56 and compute the length with a call to stdlib `strlen()`. 56 and compute the length with a call to stdlib `strlen()` (except for `NULL` in which case the length is set to zero).
57 In case you already know the length, or the string is not zero-terminated, you can use `cx_strn()` or `cx_mutstrn()`. 57 In case you already know the length, or the string is not zero-terminated, you can use `cx_strn()` or `cx_mutstrn()`.
58 58
59 The function `cx_strdup_a()` allocates new memory with the given `allocator` and copies the given `string` 59 The function `cx_strdup_a()` allocates new memory with the given `allocator` and copies the given `string`
60 and guarantees that the result string is zero-terminated. 60 and guarantees that the result string is zero-terminated.
61 The function `cx_strdup()` is equivalent to `cx_strdup_a()`, except that it uses the [default allocator](allocator.h.md#default-allocator). 61 The function `cx_strdup()` is equivalent to `cx_strdup_a()`, except that it uses the [default allocator](allocator.h.md#default-allocator).

mercurial