-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_capitalize.c
35 lines (32 loc) · 1.14 KB
/
ft_capitalize.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
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_capitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asarandi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/09/27 13:54:17 by asarandi #+# #+# */
/* Updated: 2017/09/28 13:03:28 by asarandi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_capitalize(char *str)
{
int i;
i = 0;
while (str[i])
{
if (ft_isalpha(str[i]))
{
str[i] = ft_toupper(str[i]);
i++;
while (ft_isalpha(str[i]))
{
str[i] = ft_tolower(str[i]);
i++;
}
}
i++;
}
return (str);
}