summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/strings
diff options
context:
space:
mode:
authortylov <[email protected]>2023-08-14 09:42:35 +0200
committertylov <[email protected]>2023-08-14 09:42:35 +0200
commitfb5863de1d6ea8a5be8371e57bcd58bf31798a0a (patch)
treee2bc5d08051fd275e697472f6e5a70dd6ab6cb64 /misc/examples/strings
parent25dc58db206714dc02c1ae0548f6ba7dd3519d29 (diff)
downloadSTC-modified-fb5863de1d6ea8a5be8371e57bcd58bf31798a0a.tar.gz
STC-modified-fb5863de1d6ea8a5be8371e57bcd58bf31798a0a.zip
Finished last commit (cleanup, fixes).
Diffstat (limited to 'misc/examples/strings')
-rw-r--r--misc/examples/strings/sso_substr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/misc/examples/strings/sso_substr.c b/misc/examples/strings/sso_substr.c
index 3c6b1046..2262e349 100644
--- a/misc/examples/strings/sso_substr.c
+++ b/misc/examples/strings/sso_substr.c
@@ -5,7 +5,7 @@
int main(void)
{
- cstr str = cstr_lit("We think in generalities, but we live in details.");
+ cstr str = cstr_from("We think in generalities, but we live in details.");
csubstr sv1 = cstr_substr_ex(&str, 3, 5); // "think"
intptr_t pos = cstr_find(&str, "live"); // position of "live"
csubstr sv2 = cstr_substr_ex(&str, pos, 4); // "live"
@@ -13,8 +13,8 @@ int main(void)
printf("%.*s, %.*s, %.*s\n", c_SS(sv1), c_SS(sv2), c_SS(sv3));
cstr_assign(&str, "apples are green or red");
- cstr s2 = cstr_from_ss(cstr_substr_ex(&str, -3, 3)); // "red"
- cstr s3 = cstr_from_ss(cstr_substr_ex(&str, 0, 6)); // "apples"
+ cstr s2 = cstr_from_ss(cstr_substr_ex(&str, -3, 3)); // "red"
+ cstr s3 = cstr_from_ss(cstr_substr_ex(&str, 0, 6)); // "apples"
printf("%s %s: %d, %d\n", cstr_str(&s2), cstr_str(&s3),
cstr_is_long(&str), cstr_is_long(&s2));
c_drop (cstr, &str, &s2, &s3);