2023-10-25 13:56:45 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* :::::::: */
|
2023-10-26 19:11:30 +02:00
|
|
|
/* ft_cntwrd.c :+: :+: */
|
2023-10-25 13:56:45 +02:00
|
|
|
/* +:+ */
|
|
|
|
/* By: djonker <marvin@codam.nl> +#+ */
|
|
|
|
/* +#+ */
|
|
|
|
/* Created: 2020/11/21 20:37:04 by djonker #+# #+# */
|
2023-10-26 19:11:30 +02:00
|
|
|
/* Updated: 2023/10/18 16:56:13 by houtworm ######## odam.nl */
|
2023-10-25 13:56:45 +02:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "../libft.h"
|
|
|
|
|
|
|
|
int ft_cntwrd(char *s, char c)
|
|
|
|
{
|
|
|
|
int iw;
|
|
|
|
int is;
|
|
|
|
|
|
|
|
is = 0;
|
|
|
|
iw = 0;
|
|
|
|
while (s[is] != '\0')
|
|
|
|
{
|
|
|
|
if (s[is] == c)
|
|
|
|
while (s[is] == c)
|
|
|
|
is++;
|
|
|
|
if (s[is] != c && s[is] != '\0')
|
|
|
|
{
|
|
|
|
while (s[is] != c && s[is] != '\0')
|
|
|
|
is++;
|
|
|
|
iw++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (iw);
|
|
|
|
}
|