summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-06-10 11:29:17 +0200
committerTyge Løvset <[email protected]>2022-06-10 11:29:17 +0200
commit8883fc8108428878d3d6291ba8981cf6df72499c (patch)
tree9fbdc79019501714dc984c1fbd5eb2c7ea979bb4 /examples
parentf1d09dfcc7570e69eb6e9688b736f7b031b22b2d (diff)
downloadSTC-modified-8883fc8108428878d3d6291ba8981cf6df72499c.tar.gz
STC-modified-8883fc8108428878d3d6291ba8981cf6df72499c.zip
utf8 fixes and improvements. Some api changes.
Diffstat (limited to 'examples')
-rw-r--r--examples/cstr_match.c5
-rw-r--r--examples/utf8replace_c.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/examples/cstr_match.c b/examples/cstr_match.c
index 8130b401..3965b36a 100644
--- a/examples/cstr_match.c
+++ b/examples/cstr_match.c
@@ -14,8 +14,9 @@ int main()
printf("ends_with: %d\n", cstr_ends_with(ss, ".JPG"));
cstr s1 = cstr_new("hell😀 w😀rl🐨");
- csview ch1 = cstr_at(&s1, 10);
- csview ch2 = cstr_at_u8(&s1, 10);
+ csview ch1 = cstr_chr(&s1, 7);
+ csview ch2 = cstr_chr(&s1, 10);
+ printf("%s\nsize: %" PRIuMAX ", %" PRIuMAX "\n", cstr_str(&s1), cstr_u8size(s1), cstr_size(s1));
printf("ch1: %" c_PRIsv "\n", c_ARGsv(ch1));
printf("ch2: %" c_PRIsv "\n", c_ARGsv(ch2));
}
diff --git a/examples/utf8replace_c.c b/examples/utf8replace_c.c
index c38b37e4..52eb5bd2 100644
--- a/examples/utf8replace_c.c
+++ b/examples/utf8replace_c.c
@@ -8,7 +8,7 @@ int main() {
cstr_replace_sv(
&hello,
- csview_substr_u8(cstr_sv(&hello), 7, 1),
+ csview_u8substr(cstr_sv(&hello), 7, 1),
c_sv("🐨")
);
printf("%s\n", cstr_str(&hello));