summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authortylo <[email protected]>2020-08-18 10:46:33 +0200
committertylo <[email protected]>2020-08-18 10:46:33 +0200
commit74d7b9927b0669a44ebced755b77dc33bc3a2f14 (patch)
tree476ac22abdf334682c39fb177295b9b69745593f /examples
parent14064aee8b9a8109ffcc8cea48f1a5969122a592 (diff)
downloadSTC-modified-74d7b9927b0669a44ebced755b77dc33bc3a2f14.tar.gz
STC-modified-74d7b9927b0669a44ebced755b77dc33bc3a2f14.zip
Removed two easy-to-misuse cstr functions, and fixed missing null-termination in pop_back();
Changed API for cstr_find(), and made a general c_strnstr() function.
Diffstat (limited to 'examples')
-rw-r--r--examples/demos.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/demos.c b/examples/demos.c
index f8feb346..a3e512e5 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -17,13 +17,13 @@ void stringdemo1()
cstr_erase(&cs, 7, 5); // -nine
printf("%s.\n", cs.str);
- cstr_replace(&cs, cstr_find(cs, "seven", 0), 5, "four");
+ cstr_replace(&cs, cstr_find(&cs, "seven"), 5, "four");
printf("%s.\n", cs.str);
cstr_take(&cs, cstr_from("%s *** %s", cs.str, cs.str));
printf("%s.\n", cs.str);
- printf("find: %s\n", cs.str + cstr_find(cs, "four", 0));
+ printf("find \"four\": %s\n", cs.str + cstr_find(&cs, "four"));
// reassign:
cstr_assign(&cs, "one two three four five six seven");