-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strgrab.c
More file actions
27 lines (24 loc) · 1.08 KB
/
ft_strgrab.c
File metadata and controls
27 lines (24 loc) · 1.08 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strgrab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tyassine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 18:32:52 by tyassine #+# #+# */
/* Updated: 2016/11/07 18:32:58 by tyassine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strgrab(const char *str, char delim)
{
int i;
i = 0;
if (*str == 0)
return (NULL);
while (str[i] && str[i] != delim)
i++;
if (i)
return (ft_strndup(str, i));
return (NULL);
}