-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_wordlen.c
30 lines (27 loc) · 1.07 KB
/
ft_wordlen.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_wordlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mtan <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/02/21 17:41:03 by mtan #+# #+# */
/* Updated: 2018/02/21 17:41:10 by mtan ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_wordlen(char const *s, char c)
{
size_t i;
size_t count;
i = 0;
count = 0;
while (s[i] == c)
i++;
while (s[i] && s[i] != c)
{
count++;
i++;
}
return (count);
}