summaryrefslogtreecommitdiffstats
path: root/libft/src/ft_strclen.c
blob: fe88ca589f5fa29cad4e52d19380e7c4a64b9165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_strclen.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:07:12 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:07:12 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <stddef.h>

size_t
	ft_strclen(const char *s, int c)
{
	const char *ptr;

	ptr = s;
	while (ptr != NULL && *ptr != '\0' && *ptr != c)
		ptr++;
	return (ptr - s);
}