| 135 ```C |
135 ```C |
| 136 #include <cx/string.h> |
136 #include <cx/string.h> |
| 137 |
137 |
| 138 cxstring cx_strchr(cxstring string, int chr); |
138 cxstring cx_strchr(cxstring string, int chr); |
| 139 |
139 |
| |
140 cxstring cx_strrchr(cxstring string, int chr); |
| |
141 |
| |
142 cxstring cx_strstr(cxstring string, cxstring search); |
| |
143 |
| |
144 cxstring cx_strsubs(cxstring string, size_t start); |
| |
145 |
| |
146 cxstring cx_strsubsl(cxstring string, size_t start, size_t length); |
| |
147 |
| |
148 cxstring cx_strtrim(cxstring string); |
| |
149 |
| 140 cxmutstr cx_strchr_m(cxmutstr string, int chr); |
150 cxmutstr cx_strchr_m(cxmutstr string, int chr); |
| 141 |
151 |
| 142 cxstring cx_strrchr(cxstring string,int chr); |
|
| 143 |
|
| 144 cxmutstr cx_strrchr_m(cxmutstr string, int chr); |
152 cxmutstr cx_strrchr_m(cxmutstr string, int chr); |
| 145 |
153 |
| 146 cxstring cx_strstr(cxstring haystack, cxstring needle); |
154 cxmutstr cx_strstr_m(cxmutstr string, cxstring search); |
| 147 |
|
| 148 cxmutstr cx_strstr_m(cxmutstr haystack, cxstring needle); |
|
| 149 |
|
| 150 cxstring cx_strsubs(cxstring string, size_t start); |
|
| 151 |
|
| 152 cxstring cx_strsubsl(cxstring string, size_t start, size_t length); |
|
| 153 |
155 |
| 154 cxmutstr cx_strsubs_m(cxmutstr string, size_t start); |
156 cxmutstr cx_strsubs_m(cxmutstr string, size_t start); |
| 155 |
157 |
| 156 cxmutstr cx_strsubsl_m(cxmutstr string, size_t start, size_t length); |
158 cxmutstr cx_strsubsl_m(cxmutstr string, size_t start, size_t length); |
| 157 |
159 |
| 158 cxstring cx_strtrim(cxstring string); |
|
| 159 |
|
| 160 cxmutstr cx_strtrim_m(cxmutstr string); |
160 cxmutstr cx_strtrim_m(cxmutstr string); |
| 161 ``` |
161 ``` |
| 162 |
162 |
| 163 > Documentation work in progress. |
163 The functions `cx_strchr()`, `cx_strrchr()`, and `cx_strstr()`, behave like their stdlib counterparts. |
| 164 >{style="warning"} |
164 |
| |
165 The function `cx_strsubs()` returns the substring starting at the specified `start` index, |
| |
166 and `cx_strsubsl()` returns a substring with at most `length` bytes. |
| |
167 |
| |
168 The function `cx_strtrim()` returns the substring that results when removing all leading and trailing |
| |
169 whitespace characters (a space character is one of the following string: `" \t\r\n\v\f"`). |
| |
170 |
| |
171 All functions with the `_m` suffix behave exactly the same as their counterparts without `_m` suffix, |
| |
172 except that they operate on a `cxmustr`. |
| |
173 In _both_ variants the functions return a view into the given `string` |
| |
174 and thus the returned strings must never be passed to `cx_strfree()`. |
| 165 |
175 |
| 166 ## Replace Substrings |
176 ## Replace Substrings |
| 167 |
177 |
| 168 ```C |
178 ```C |
| 169 #include <cx/string.h> |
179 #include <cx/string.h> |