summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/sso_substr.c
diff options
context:
space:
mode:
author_Tradam <[email protected]>2023-09-08 01:29:47 +0000
committerGitHub <[email protected]>2023-09-08 01:29:47 +0000
commit3c76c7f3d5db3f9586a90d03f8fbb02d79de9acd (patch)
treeafbe4b540967223911f7c5de36559b82154f02f3 /misc/examples/sso_substr.c
parent0841165881871ee01b782129be681209aeed2423 (diff)
parent1a72205fe05c2375cfd380dd8381a8460d9ed8d1 (diff)
downloadSTC-modified-modified.tar.gz
STC-modified-modified.zip
Merge branch 'stclib:master' into modifiedHEADmodified
Diffstat (limited to 'misc/examples/sso_substr.c')
-rw-r--r--misc/examples/sso_substr.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/misc/examples/sso_substr.c b/misc/examples/sso_substr.c
deleted file mode 100644
index 4b2dbcc8..00000000
--- a/misc/examples/sso_substr.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stc/cstr.h>
-#include <stc/csview.h>
-
-int main ()
-{
- cstr str = cstr_lit("We think in generalities, but we live in details.");
- csview sv1 = cstr_substr_ex(&str, 3, 5); // "think"
- intptr_t pos = cstr_find(&str, "live"); // position of "live"
- csview sv2 = cstr_substr_ex(&str, pos, 4); // "live"
- csview sv3 = cstr_slice_ex(&str, -8, -1); // "details"
- printf("%.*s, %.*s, %.*s\n", c_SV(sv1), c_SV(sv2), c_SV(sv3));
-
- cstr_assign(&str, "apples are green or red");
- cstr s2 = cstr_from_sv(cstr_substr_ex(&str, -3, 3)); // "red"
- cstr s3 = cstr_from_sv(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);
-}