37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strstr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/07/18 21:31:36 by adjoly #+# #+# */
|
|
/* Updated: 2023/07/20 22:14:23 by adjoly ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
char *ft_strstr(char *str, char *to_find)
|
|
{
|
|
int i;
|
|
int j;
|
|
|
|
i = 0;
|
|
j = 0;
|
|
if (to_find[0] == '\0')
|
|
{
|
|
return (str);
|
|
}
|
|
while (str[i])
|
|
{
|
|
while (str[i + j] == to_find[j])
|
|
{
|
|
if (to_find[j + 1] == '\0')
|
|
return (&str[i]);
|
|
j++;
|
|
}
|
|
j = 0;
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|