Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char *ft_strcapitalize(char *str)
- {
- int run;
- run = 0;
- while (str[run] != '\0')
- {
- if ((str[run] == 43) || (str[run] == 45) || (str[run] == 32))
- {
- if ((str[run + 1] > 96) && (str[run + 1] < 123))
- {
- str[run + 1] = str[run + 1] - 32;
- }
- }
- else if ((str[run] != 43) || (str[run] != 45) || (str[run] != 32))
- {
- if ((str[run + 1] > 64) && (str[run + 1] < 91))
- {
- str[run + 1] = str[run + 1] + 32;
- }
- }
- run++;
- }
- }
- int main()
- {
- char stroka[] = "salut, comment tu vas ? 42mots quarante-deux; cinquante+et+un";
- ft_strcapitalize(stroka);
- printf("%s", stroka);
- }
Advertisement
Add Comment
Please, Sign In to add comment