LIBSSDP
 All Classes Files Functions Variables Typedefs Macros
string_utils.c
Go to the documentation of this file.
1 
7 #include <string.h>
8 
9 #include "string_utils.h"
10 
11 int strpos(const char *haystack, const char *needle) {
12  char *p = strstr(haystack, needle);
13  if(p) {
14  return p-haystack;
15  }
16  return -1;
17 }
18 
19 unsigned char strcount(const char *haystack, const char *needle) {
20  unsigned char count = 0;
21  const char *pos = haystack;
22 
23  do {
24  pos = strstr(pos, needle);
25  if(pos != NULL) {
26  count++;
27  pos++;
28  }
29  } while(pos != NULL);
30 
31  return count;
32 
33 }
34 
unsigned char strcount(const char *haystack, const char *needle)
Definition: string_utils.c:19
int strpos(const char *haystack, const char *needle)
Definition: string_utils.c:11