-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strtok.c
30 lines (27 loc) · 1.12 KB
/
ft_strtok.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtok.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: stales <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/13 14:20:16 by stales #+# #+# */
/* Updated: 2022/04/01 12:39:33 by stales ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strtok(char *str, char *token)
{
static char *p;
if (str)
p = str;
if (!p || !token)
return (LIBFT_NULL);
str = p;
if (!*str)
return (LIBFT_NULL);
p += ft_strcspn(str, token);
if (*p)
*p++ = 0;
return (str);
}