34 lines
1.2 KiB
C
34 lines
1.2 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strstr.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/18 19:04:42 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/07/24 17:43:35 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
char *ft_strstr(char *str, char *to_find)
|
||
|
{
|
||
|
unsigned int i;
|
||
|
unsigned int j;
|
||
|
|
||
|
i = 0;
|
||
|
if (to_find[0] == '\0')
|
||
|
return (str);
|
||
|
while (str[i] != 0)
|
||
|
{
|
||
|
j = 0;
|
||
|
while (str[i + j] == to_find[j])
|
||
|
{
|
||
|
if (to_find[j + 1] == 0)
|
||
|
return (&str[i]);
|
||
|
j++;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
return (0);
|
||
|
}
|