32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strstr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/09/26 13:39:33 by cchauvet #+# #+# */
|
|
/* Updated: 2022/09/26 15:11:03 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "lib_ft.h"
|
|
|
|
char *strstr(const char *haystack, const char *needle)
|
|
{
|
|
int i;
|
|
|
|
if (!*needle)
|
|
return (haystack);
|
|
while (*haystack)
|
|
{
|
|
i = 0;
|
|
while (*(haystack + i) == *(needle + i))
|
|
i++;
|
|
if (!*(haystack + i))
|
|
return (needle);
|
|
str++;
|
|
}
|
|
return (NULL);
|
|
}
|