eg0rmaffin

ft_strcapitalize_alpha

Jul 9th, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char        *ft_strcapitalize(char *str)
  4. {
  5.     int     run;
  6.  
  7.     run = 0;
  8.     while (str[run] != '\0')
  9.     {
  10.         if ((str[run] == 43) || (str[run] == 45) || (str[run] == 32))
  11.         {
  12.             if ((str[run + 1] > 96) && (str[run + 1] < 123))
  13.             {
  14.                 str[run + 1] = str[run + 1] - 32;
  15.             }
  16.         }
  17.         else if ((str[run] != 43) || (str[run] != 45) || (str[run] != 32))
  18.         {
  19.             if ((str[run + 1] > 64) && (str[run + 1] < 91))
  20.             {
  21.                 str[run + 1] = str[run + 1] + 32;
  22.             }
  23.         }
  24.         run++;
  25.     }
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. int     main()
  39. {
  40.     char    stroka[] = "salut, comment tu vas ? 42mots quarante-deux; cinquante+et+un";
  41.     ft_strcapitalize(stroka);
  42.     printf("%s", stroka);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment