forked from frdescam/PISCINE
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
C
37 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strstr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: frdescam <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2019/06/07 16:26:41 by frdescam #+# #+# */
|
|
/* Updated: 2019/06/12 14:38:23 by frdescam ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
char *ft_strstr(char *str, char *to_find)
|
|
{
|
|
int i;
|
|
int j;
|
|
|
|
if (to_find[0] == '\0')
|
|
return (str);
|
|
i = 0;
|
|
while (str[i])
|
|
{
|
|
j = 0;
|
|
if (str[i] == to_find[j])
|
|
{
|
|
while (str[i + j] == to_find[j])
|
|
{
|
|
j++;
|
|
if (!to_find[j])
|
|
return (&str[i]);
|
|
}
|
|
}
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|