blob: c38b37e4a6a92c82046e7c6286e83bd072f660be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <stc/cstr.h>
#include <stc/csview.h>
int main() {
c_auto (cstr, hello) {
hello = cstr_new("hell😀 w😀rld");
printf("%s\n", cstr_str(&hello));
cstr_replace_sv(
&hello,
csview_substr_u8(cstr_sv(&hello), 7, 1),
c_sv("🐨")
);
printf("%s\n", cstr_str(&hello));
cstr_replace(&hello, "🐨", "ø");
printf("%s\n", cstr_str(&hello));
c_foreach (c, cstr, hello)
printf("%" c_PRIsv ",", c_ARGsv(c.chr));
puts("");
}
}
|