/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strcnb.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bgoulard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/28 10:58:46 by bgoulard #+# #+# */ /* Updated: 2024/12/16 06:02:31 by bgoulard ### ########.fr */ /* */ /* ************************************************************************** */ #include size_t ft_strcnb(const char *str, char c) { size_t i; size_t nb; i = 0; nb = 0; if (!str) return (0); while (str[i]) if (str[i++] == c) nb++; if (c == '\0') nb++; return (nb); }