42_C_PISCINE/C/c02/ex07/ft_strupcase.c

50 lines
1.3 KiB
C
Raw Normal View History

2023-05-17 12:45:25 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:11:54 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('a' <= str[i] && str[i] <= 'z')
str[i] = str[i] - 32;
i++;
}
return (str);
}
/*
void ft_print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int main(void)
{
char a[4] = "test";
ft_print(ft_strupcase(a));
char b[4] = "TEST";
ft_print(ft_strupcase(b));
char c[4] = "t3st";
ft_print(ft_strupcase(c));
char d[4] = "t3St";
ft_print(ft_strupcase(d));
}
*/