Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Solution must be written in C. Write a function void camelCase(char* word) where

ID: 3891178 • Letter: S

Question

Solution must be written in C.

Write a function void camelCase(char* word) where the argument of the function is a string that must consist of two or more words separated by one or more underscores such as “random_word” or "this_is_my_first_programming_assignment". camelCase(..) should remove underscores from the sentence and rewrite it in "lower camel case (A naming convention of the CamelCase family in which several words are joined together, where the first letter of the entire word is lowercase, but subsequent first letters are uppercase)" (https://en.wikipedia.org/wiki/Camel_case).Watch out for the end of the string, which is denoted by ‘’. You also have to make sure that an user provided input string is in valid form first before you use it for the function camelCase(..).

Below are some examples of the conversions that are expected - a) "_random_ _word" should be changed to "random_word" first. b) "@$random4word" should be changed to "random_word" first. c) " random word " should be changed to "random_word" first. d) "random word" should be changed to "random_word" first. e) "RANDOM_Word" should be changed to "random_word" first. f) One or more combinations from options a, b, c, d and e.

The strings that you must not allow as arguments are - "_", "__ _", " ", "435_%7_$$", "random", "_random_". Print “invalid input string” for such cases. You are allowed to limit the size of the input string you will provide. Finally, do not use the library functions isupper(..), islower(..) or strlen(..).

Write the functions on your own to perform such operations..

Explanation / Answer

void camelCase(char* word){

char* temp[1000];

int i=0;

temp = word;

while(*word[i]!=""){

i++;

}

if((*word=="_")||(*word=="_ _ _")||(*word==" ")||(*word=="435_%7_$$")||(*word=="random")||(*word=="_random_"){

printf("invalid string");

goto label;

}

for(j=0,k=0;k<=i+1;j++,k++){

if(*word[k]=="_"){

while(*word[k]=="_"){

++k;

}

if((*word[k]>=97)&& (*word[k]<=122)){

*temp[j]=*word[k]-32;

}

else{

*temp[j]=*word[k];

}

}

else

*temp[j]=*word[k];

}

if((*temp[0]>=41) && (*temp<=90)){

*temp[0]=*temp[0]+32;

}

label: getch();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote