libft/sources/libft_srcs/ft_strstr.c
char	*ft_strstr(const char *haystack, const char *needle)
{
	size_t	i;
	size_t	j;

	i = 0;
	if (haystack[i] == '\0' && needle[i] == '\0')
		return ((char*)haystack);
	while (haystack[i] != '\0')
	{
		j = 0;
		while (haystack[i + j] == needle[j] && needle[j] != '\0')
			j = j + 1;
		if (needle[j] == '\0')
			return ((char*)&haystack[i]);
		i = i + 1;
	}
	return (NULL);
}
/*
** The strstr() function locates the first occurrence
** of the null-terminated string needle
** in the null-terminated string haystack.
*/
The strstr() function locates the first occurrence
of the null-terminated string needle
in the null-terminated string haystack.
The strstr () function locates the first occurrence of the null - terminated string needle in the null - terminated string haystack .
char	*ft_strstr(const char *haystack, const char *needle)
{
	size_t	i;
	size_t	j;
	i = 0;
	if (haystack[i] == '\0' && needle[i] == '\0')
		return ((char*)haystack);
	while (haystack[i] != '\0')
	{
		j = 0;
		while (haystack[i + j] == needle[j] && needle[j] != '\0')
			j = j + 1;
		if (needle[j] == '\0')
			return ((char*)&haystack[i]);
		i = i + 1;
	}
	return (NULL);
}
char * ft_strstr ( const char * haystack , const char * needle ) { size_t i ; size_t j ; i = 0 ; if ( haystack [ i ] == ' \0 ' && needle [ i ] == ' \0 ' ) return ( ( char * ) haystack ) ; while ( haystack [ i ] != ' \0 ' ) { j = 0 ; while ( haystack [ i + j ] == needle [ j ] && needle [ j ] != ' \0 ' ) j = j + 1 ; if ( needle [ j ] == ' \0 ' ) return ( ( char * ) & haystack [ i ] ) ; i = i + 1 ; } return ( NULL ) ; }
The strstr() function locates the first occurrence
of the null-terminated string needle
in the null-terminated string haystack.
The strstr () function locates the first occurrence of the null - terminated string needle in the null - terminated string haystack .