docs/Writerside/topics/string.h.md

Wed, 29 Jan 2025 23:58:17 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 29 Jan 2025 23:58:17 +0100
branch
docs/3.1
changeset 1165
e4e2c43d12c2
parent 1146
151c057faf7c
permissions
-rw-r--r--

basic structur for the strings chapter

relates to #451

1143
0559812df10c assign proper names to the documentation topics
Mike Becker <universe@uap-core.de>
parents: 1142
diff changeset
1 # String
1141
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2
1146
151c057faf7c add marker to every incomplete page
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
3 <warning>
151c057faf7c add marker to every incomplete page
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
4 Outdated - Rewrite!
151c057faf7c add marker to every incomplete page
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
5 </warning>
151c057faf7c add marker to every incomplete page
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
6
1141
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 UCX strings come in two variants: immutable (`cxstring`) and mutable (`cxmutstr`).
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 The functions of UCX are designed to work with immutable strings by default but in situations where it is necessary,
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 the API also provides alternative functions that work directly with mutable strings.
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 Functions that change a string in-place are, of course, only accepting mutable strings.
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 When you are using UCX functions, or defining your own functions, you are sometimes facing the "problem",
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 that the function only accepts arguments of type `cxstring` but you only have a `cxmutstr` at hand.
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 In this case you _should not_ introduce a wrapper function that accepts the `cxmutstr`,
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 but instead you should use the `cx_strcast()` function to cast the argument to the correct type.
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 In general, UCX strings are **not** necessarily zero-terminated. If a function guarantees to return zero-terminated
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 string, it is explicitly mentioned in the documentation of the respective function.
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 As a rule of thumb, you _should not_ pass the strings of a UCX string structure to another API without explicitly
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 ensuring that the string is zero-terminated.
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
21
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
22 ## Basics
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
23
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
24 ### cx_mutstr
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
25 ### cx_mutstrn
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
26 ### cx_str
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
27 ### cx_strn
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
28 ### cx_strcast
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
29 ### cx_strfree
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
30 ### cx_strfree_a
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
31 ### cx_strdup
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
32 ### cx_strdup_a
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
33 ### cx_strlen
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
34 ### cx_strtrim
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
35 ### cx_strtrim_m
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
36 ### cx_strlower
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
37 ### cx_strupper
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
38
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
39 ## Comparison
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
40
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
41 ### cx_strcmp
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
42 ### cx_strcmp_p
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
43 ### cx_strcasecmp
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
44 ### cx_strcasecmp_p
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
45 ### cx_strprefix
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
46 ### cx_strsuffix
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
47 ### cx_strcaseprefix
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
48 ### cx_strcasesuffix
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
49
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
50 ## Concatenation
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
51
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
52 ### cx_strcat_ma
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
53
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
54 ## Find Characters and Substrings
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
55
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
56 ### cx_strchr
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
57 ### cx_strchr_m
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
58 ### cx_strrchr
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
59 ### cx_strrchr_m
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
60 ### cx_strstr
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
61 ### cx_strstr_m
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
62 ### cx_strsubs
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
63 ### cx_strsubsl
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
64 ### cx_strsubsl_m
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
65 ### cx_strsubs_m
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
66
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
67 ## Replace Substrings
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
68
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
69 ### cx_strreplacen_a
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
70
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
71 ## Basic Splitting
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
72
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
73 ### cx_strsplit
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
74 ### cx_strsplit_a
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
75 ### cx_strsplit_m
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
76 ### cx_strsplit_ma
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
77
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
78 ## Complex Tokenization
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
79
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
80 ### cx_strtok_
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
81 ### cx_strtok_delim
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
82 ### cx_strtok_next
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
83 ### cx_strtok_next_m
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
84
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
85 ## Conversion to Numbers
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
86
1142
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
87 ### cx_strtod_lc_
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
88 ### cx_strtof_lc_
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
89 ### cx_strtoi16_lc_
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
90 ### cx_strtoi32_lc_
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
91 ### cx_strtoi64_lc_
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
92 ### cx_strtoi8_lc_
9437530176bc add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
93 ### cx_strtoi_lc_
1165
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
94 ### cx_strtol_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
95 ### cx_strtoll_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
96 ### cx_strtos_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
97 ### cx_strtou16_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
98 ### cx_strtou32_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
99 ### cx_strtou64_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
100 ### cx_strtou8_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
101 ### cx_strtou_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
102 ### cx_strtoul_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
103 ### cx_strtoull_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
104 ### cx_strtous_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
105 ### cx_strtouz_lc
e4e2c43d12c2 basic structur for the strings chapter
Mike Becker <universe@uap-core.de>
parents: 1146
diff changeset
106 ### cx_strtoz_lc

mercurial