-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strstr.c
32 lines (29 loc) · 1.14 KB
/
ft_strstr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rnbou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/07 00:00:15 by rnbou #+# #+# */
/* Updated: 2018/10/10 13:12:59 by rnbou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strstr(const char *h, const char *ne)
{
int i;
char *c;
c = (char *)h;
if (ft_strlen(ne) == 0)
return (c);
i = 0;
while (h[i] != '\0')
{
if (ft_strncmp(h + i, ne,
ft_strlen(ne)) == 0)
return (c + i);
i++;
}
return (NULL);
}