text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_strnstr.c                                       :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: nvienot <nvienot@student.42.fr>            +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2018/11/15 21:45:30 by nvienot           #+#    #+#             */
  /*   Updated: 2018/11/21 15:03:48 by nvienot          ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  
  char	*ft_strnstr(const char *haystack, const char *needle, size_t len)
  {
  	size_t	i;
  	size_t	j;
  
  	i = 0;
  	while (i < len && haystack[i] != '\0')
  	{
  		j = 0;
  		while (needle[j] != '\0')
  		{
  			if (i + j >= len || haystack[i + j] != needle[j])
  				break ;
  			j++;
  		}
  		if (needle[j] == '\0')
  			return ((char *)(haystack + i));
  		i++;
  	}
  	return (0);
  }
  