add: strstr

This commit is contained in:
starnakin 2024-09-06 23:09:04 +02:00
parent 37c15e5740
commit c9c5479bbb

14
src/string/strstr.c Normal file
View File

@ -0,0 +1,14 @@
char *strstr(const char *haystack, const char *needle)
{
size_t i = 0;
size_t len;
len = strlen(needle);
while (haystack[i] != '\0')
{
if (strncmp(haystack + i, needle, len) == 0)
return haystack + i;
i++;
}
return NULL;
}