diff options
| author | Tyge Løvset <[email protected]> | 2021-05-24 19:12:36 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-05-24 19:18:40 +0200 |
| commit | 935654467bc53ab93cff4e66bda09a173fc5bbac (patch) | |
| tree | fc4c5ccf8698d5d94b06b41d1675121d8bae014b /examples | |
| parent | 1490bbe1aa98b4081c226060834d54d05bf7e6e3 (diff) | |
| parent | 70ef2e51798d01e5be149936fab5bd74368e71fd (diff) | |
| download | STC-modified-935654467bc53ab93cff4e66bda09a173fc5bbac.tar.gz STC-modified-935654467bc53ab93cff4e66bda09a173fc5bbac.zip | |
Merge branch 'master' of https://github.com/tylo-work/C99Containers into master
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/cstr_match.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/cstr_match.c b/examples/cstr_match.c new file mode 100644 index 00000000..07a6b8d4 --- /dev/null +++ b/examples/cstr_match.c @@ -0,0 +1,15 @@ +#include <stc/cstr.h>
+#include <stdio.h>
+
+int main()
+{
+ c_forvar (cstr ss = cstr_lit("The quick brown fox jumps over the lazy dog.JPG"), cstr_del(&ss)) {
+ size_t pos = cstr_find_n(ss, "brown", 0, 5);
+ printf("%zu [%s]\n", pos, pos == cstr_npos ? "<NULL>" : &ss.str[pos]);
+ printf("iequals: %d\n", cstr_iequals(ss, "the quick brown fox jumps over the lazy dog.jpg"));
+ printf("icontains: %d\n", cstr_icontains(ss, "uMPS Ove"));
+ printf("ibegins_with: %d\n", cstr_ibegins_with(ss, "The Quick Brown"));
+ printf("iends_with: %d\n", cstr_iends_with(ss, ".Jpg"));
+ printf("ends_with: %d\n", cstr_ends_with(ss, ".JPG"));
+ }
+}
\ No newline at end of file |
