1
0

first commit

This commit is contained in:
Adam Joly
2023-08-03 23:16:27 +02:00
parent 7f3254f1c5
commit a80c4d61d7
133 changed files with 4293 additions and 0 deletions

View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 18:12:38 by adjoly #+# #+# */
/* Updated: 2023/07/18 21:24:58 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcapitalize(char *str)
{
int i;
i = 0;
if (str[i] >= 'a' && str[i] <= 'z')
str[i] -= 32;
i++;
while (str[i])
{
if ((str[i] >= 'a' && str[i] <= 'z')
&& !((str[i - 1] >= '0' && str[i - 1] <= '9')
|| (str[i - 1] >= 'a' && str[i - 1] <= 'z')
|| (str[i - 1] >= 'A' && str[i - 1] <= 'Z')))
str[i] -= 32;
else if (str[i] >= 'A' && str[i] <= 'Z'
&& ((str[i - 1] >= '0' && str[i - 1] <= '9')
|| (str[i - 1] >= 'a' && str[i - 1] <= 'z')
|| (str[i - 1] >= 'A' && str[i - 1] <= 'Z')))
str[i] += 32;
i++;
}
return (str);
}