summaryrefslogtreecommitdiffhomepage
path: root/examples/utf8replace_c.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/utf8replace_c.c')
-rw-r--r--examples/utf8replace_c.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/utf8replace_c.c b/examples/utf8replace_c.c
index c38b37e4..86d8bd69 100644
--- a/examples/utf8replace_c.c
+++ b/examples/utf8replace_c.c
@@ -1,3 +1,4 @@
+#define i_implement
#include <stc/cstr.h>
#include <stc/csview.h>
@@ -6,14 +7,12 @@ int main() {
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("🐨")
- );
+ /* replace second smiley at utf8 codepoint pos 7 */
+ cstr_u8_replace_at(&hello, 7, 1, c_sv("🐨"));
+
printf("%s\n", cstr_str(&hello));
- cstr_replace(&hello, "🐨", "ø");
+ cstr_replace(&hello, "🐨", "ø", 1);
printf("%s\n", cstr_str(&hello));
c_foreach (c, cstr, hello)