Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <ctype.h>
  5.  
  6. int camelize(char text[]);
  7.  
  8. int main(){
  9.  
  10. char text[] = "Welcome to my world.";
  11. printf("%s\n", text);
  12. camelize(text);
  13. printf("%s\n", text);
  14.  
  15.   return 0;
  16. }
  17.  
  18. int camelize(char text[]){
  19.  
  20.   if(text == NULL){
  21.     return -1;
  22.   }
  23.   for(int i = 0; i < strlen(text); i++){
  24.     if(text[i] == ' '){
  25.       i++;
  26.       text[i] = toupper(text[i]);
  27.     }
  28.   }
  29.      int i = 0;
  30.     while(i < strlen(text)){
  31.       if(isspace(text[i])){
  32.         for(int j = i; j < strlen(text); j++){
  33.           text[j] = text[j+1];
  34.         }
  35.       }
  36.     i++;
  37.   }
  38.   return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement