-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strcspn.c
27 lines (24 loc) · 1.06 KB
/
ft_strcspn.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcspn.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: stales <stales@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/13 12:31:59 by stales #+# #+# */
/* Updated: 2022/03/13 12:35:36 by stales ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_size ft_strcspn(char *s, const char *rejects)
{
char *tmp;
tmp = s;
while (*tmp)
{
if (ft_strchr(rejects, *tmp))
return (tmp - s);
tmp++;
}
return (tmp - s);
}