aboutsummaryrefslogtreecommitdiff
path: root/test_mini/libft/src/str/ft_strcspn.c
blob: 7cc06a5fb38bb827c26962c342a96575abd56c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_strcspn.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/10 04:30:59 by cacharle          #+#    #+#             */
/*   Updated: 2020/02/10 04:32:15 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft_str.h"

size_t	ft_strcspn(const char *s, const char *charset)
{
	int	i;

	i = 0;
	while (ft_strchr(charset, s[i]) == NULL)
		i++;
	return (i);
}