damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

str.c (283B)


      1 /* CC0 (Public domain) - see LICENSE file for details */
      2 #include <ccan/str/str.h>
      3 
      4 size_t strcount(const char *haystack, const char *needle)
      5 {
      6 	size_t i = 0, nlen = strlen(needle);
      7 
      8 	while ((haystack = strstr(haystack, needle)) != NULL) {
      9 		i++;
     10 		haystack += nlen;
     11 	}
     12 	return i;
     13 }