139 Note, that `count` always denotes the number of variadic arguments in _both_ variants. |
139 Note, that `count` always denotes the number of variadic arguments in _both_ variants. |
140 |
140 |
141 The function `cx_strlen()` sums the length of the specified strings. |
141 The function `cx_strlen()` sums the length of the specified strings. |
142 |
142 |
143 > There is no reason to use `cx_strlen()` for a single UCX string. |
143 > There is no reason to use `cx_strlen()` for a single UCX string. |
144 > Just access the `length` field of the structure directly. |
144 > You can access the `length` field of the structure directly. |
145 |
145 |
146 > You can mix `cxstring` and `cxmutstr` in the variadic arguments without the need of `cx_strcast()`. |
146 > You can mix `cxstring` and `cxmutstr` in the variadic arguments without the need of `cx_strcast()`. |
147 |
147 |
148 ## Find Characters and Substrings |
148 ## Find Characters and Substrings |
149 |
149 |
179 |
179 |
180 The function `cx_strsubs()` returns the substring starting at the specified `start` index, |
180 The function `cx_strsubs()` returns the substring starting at the specified `start` index, |
181 and `cx_strsubsl()` returns a substring with at most `length` bytes. |
181 and `cx_strsubsl()` returns a substring with at most `length` bytes. |
182 |
182 |
183 The function `cx_strtrim()` returns the substring that results when removing all leading and trailing |
183 The function `cx_strtrim()` returns the substring that results when removing all leading and trailing |
184 whitespace characters (a space character is one of the following string: `" \t\r\n\v\f"`). |
184 whitespace characters. |
185 |
185 |
186 All functions with the `_m` suffix behave exactly the same as their counterparts without `_m` suffix, |
186 All functions with the `_m` suffix behave exactly the same as their counterparts without `_m` suffix, |
187 except that they operate on a `cxmustr`. |
187 except that they operate on a `cxmustr`. |
188 In _both_ variants the functions return a view into the given `string` |
188 In _both_ variants the functions return a view into the given `string` |
189 and thus the returned strings must never be passed to `cx_strfree()`. |
189 and thus the returned strings must never be passed to `cx_strfree()`. |
304 } |
304 } |
305 ``` |
305 ``` |
306 |
306 |
307 ## Conversion to Numbers |
307 ## Conversion to Numbers |
308 |
308 |
309 For each integer type, as well as `float` and `double`, there are functions to convert a UCX string to a number of that type. |
309 For each integer type, as well as `float` and `double`, there are functions to convert a UCX string to a value of those types. |
310 |
310 |
311 Integer conversion comes in two flavours: |
311 Integer conversion comes in two flavors: |
312 ```C |
312 ```C |
313 int cx_strtoi(AnyStr str, int *output, int base); |
313 int cx_strtoi(AnyStr str, int *output, int base); |
314 |
314 |
315 int cx_strtoi_lc(AnyStr str, int *output, int base, |
315 int cx_strtoi_lc(AnyStr str, int *output, int base, |
316 const char *groupsep); |
316 const char *groupsep); |
322 |
322 |
323 The `_lc` versions of the integer conversion functions are equivalent, except that they allow the specification of an |
323 The `_lc` versions of the integer conversion functions are equivalent, except that they allow the specification of an |
324 array of group separator chars, each of which is simply ignored during conversion. |
324 array of group separator chars, each of which is simply ignored during conversion. |
325 The default group separator for the basic version is a comma `,`. |
325 The default group separator for the basic version is a comma `,`. |
326 |
326 |
327 The signature for the floating point conversions is quite similar: |
327 The signature for the floating-point conversions is quite similar: |
328 ```C |
328 ```C |
329 int cx_strtof(AnyStr str, float *output); |
329 int cx_strtof(AnyStr str, float *output); |
330 |
330 |
331 int cx_strtof_lc(AnyStr str, float *output, |
331 int cx_strtof_lc(AnyStr str, float *output, |
332 char decsep, const char *groupsep); |
332 char decsep, const char *groupsep); |
333 ``` |
333 ``` |
334 |
334 |
335 The two differences are that the floating point versions do not support different bases, |
335 The two differences are that the floating-point versions do not support different bases, |
336 and the `_lc` variant allows specifying not only an array of group separators, |
336 and the `_lc` variant allows specifying not only an array of group separators, |
337 but also the character used for the decimal separator. |
337 but also the character used for the decimal separator. |
338 |
338 |
339 In the basic variant, the group separator is again a comma `,`, and the decimal separator is a dot `.`. |
339 In the basic variant, the group separator is again a comma `,`, and the decimal separator is a dot `.`. |
340 |
340 |
341 > The floating point conversions of UCX 3.1 do not achieve the same precision as standard library implementations |
341 > The floating-point conversions of UCX 3.1 do not achieve the same precision as standard library implementations |
342 > which usually use more sophisticated algorithms. |
342 > which usually use more sophisticated algorithms. |
343 > The precision might increase in future UCX releases, |
343 > The precision might increase in future UCX releases, |
344 > but until then be aware of slight inaccuracies, in particular when working with `double`. |
344 > but until then be aware of slight inaccuracies, in particular when working with `double`. |
345 {style="warning"} |
345 {style="warning"} |
346 |
346 |