32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strstr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2021/08/12 16:49:31 by gbaconni #+# #+# */
|
|
/* Updated: 2021/08/12 17:11:14 by gbaconni ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <stdlib.h>
|
|
|
|
char *ft_strstr(char *str, char *to_find)
|
|
{
|
|
unsigned int i;
|
|
unsigned int j;
|
|
|
|
i = 0;
|
|
while (str[i] != '\0')
|
|
{
|
|
j = 0;
|
|
while (str[i + j] != '\0' && str[i + j] == to_find[j])
|
|
j++;
|
|
if (to_find[j] == '\0')
|
|
return (str + i);
|
|
i++;
|
|
}
|
|
return (NULL);
|
|
}
|