#include <stdio.h>
char *ft_strcapitalize(char *str)
{
int index = 0;
while (str[index] != '\0')
{
if (str[index] >= 'A' && str[index] <= 'Z')
{
str[index] = str[index] + 32;
}
if ((str[index] >= 'a' && str[index] <= 'z') && str[index - 1] <= 47)
{
str[index] = str[index] - 32;
}
index++;
}
return (str);
}
int main() {
char str[] = "salut, comment tu dusf;dou.vas BoaRDd HELLO ? 42\nmots quarante-deux; cinquante+et+un";
ft_strcapitalize(str);
printf("%s\n", str);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: