summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-23 14:44:05 +0200
committerTyge Løvset <[email protected]>2022-05-23 14:44:05 +0200
commit7349441c0c95b21da87f1a13176ac4014ed98ea8 (patch)
tree5de86b3c64f7de4f8051e83655d3519b0bcef23d /examples
parent673de33eeb754142a32ac5cad551230d8fc86849 (diff)
downloadSTC-modified-7349441c0c95b21da87f1a13176ac4014ed98ea8.tar.gz
STC-modified-7349441c0c95b21da87f1a13176ac4014ed98ea8.zip
Renamed cstr_find_n(self, search, pos, nmax) => cstr_find_from(self, pos, search),
and cstr_replace_first(self, search, repl) => cstr_replace_first(self, pos, search, repl). // returns pos after replaced str.
Diffstat (limited to 'examples')
-rw-r--r--examples/cstr_match.c2
-rw-r--r--examples/demos.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/cstr_match.c b/examples/cstr_match.c
index 08236a0d..cd3f04be 100644
--- a/examples/cstr_match.c
+++ b/examples/cstr_match.c
@@ -4,7 +4,7 @@
int main()
{
c_autovar (cstr ss = cstr_new("The quick brown fox jumps over the lazy dog.JPG"), cstr_drop(&ss)) {
- size_t pos = cstr_find_n(ss, "brown", 0, 5);
+ size_t pos = cstr_find_from(ss, 0, "brown");
printf("%" PRIuMAX " [%s]\n", pos, pos == cstr_npos ? "<NULL>" : cstr_str(&ss) + pos);
printf("equals: %d\n", cstr_equals(ss, "The quick brown fox jumps over the lazy dog.JPG"));
printf("contains: %d\n", cstr_contains(ss, "umps ove"));
diff --git a/examples/demos.c b/examples/demos.c
index 1304cf85..99b9e570 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -13,7 +13,7 @@ void stringdemo1()
cstr_erase_n(&cs, 7, 5); // -nine
printf("%s.\n", cstr_str(&cs));
- cstr_replace_first(&cs, "seven", "four");
+ cstr_replace_first(&cs, 0, "seven", "four");
printf("%s.\n", cstr_str(&cs));
cstr_take(&cs, cstr_from_fmt("%s *** %s", cstr_str(&cs), cstr_str(&cs)));