42-archive/ftp/libft/srcs/str/ft_strcspn.c

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcspn.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 15:55:33 by jhalford #+# #+# */
/* Updated: 2017/11/10 15:52:55 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** span the complement of a string
*/
size_t ft_strcspn(char *s, const char *delim)
{
char *str;
str = s;
while (*str)
if (ft_strchr(delim, *str))
return (str - s);
else
str++;
return (str - s);
}