From 74d7b9927b0669a44ebced755b77dc33bc3a2f14 Mon Sep 17 00:00:00 2001 From: tylo Date: Tue, 18 Aug 2020 10:46:33 +0200 Subject: 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. --- examples/demos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples') 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"); -- cgit v1.2.3