diff options
Diffstat (limited to 'src/strops.cpp')
| -rw-r--r-- | src/strops.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/strops.cpp b/src/strops.cpp index 42042cb..116eec4 100644 --- a/src/strops.cpp +++ b/src/strops.cpp @@ -1,4 +1,5 @@ #include <string.h> +#include <ctype.h> #include "strops.hpp" @@ -15,4 +16,20 @@ size_t strops_copy(char *dst, const char *src, size_t size) dst[srclen] = '\0'; return (srclen); +} + +char* strops_stristr(char* haystack, char* needle) +{ + do { + const char* h = haystack; + const char* n = needle; + while (tolower((unsigned char) *h) == tolower((unsigned char ) *n) && *n) { + h++; + n++; + } + if (*n == 0) { + return (char *) haystack; + } + } while (*haystack++); + return 0; }
\ No newline at end of file |
