Showing posts with label toLowerCase() program. Show all posts
Showing posts with label toLowerCase() program. Show all posts
on Sunday, 14 April 2013

/* Logic of toLowerCase() in c language */

#include<stdio.h>


void toUpperCase(char *source){
int index=0;

while(source[index]!='\0'){

char ch=source[index];
// first check it is valid alphabet or not

if(!(ch&64)){
index++;
continue;
}


// is already lowerCase
if(ch&32){
index++;
continue;
}

switch(ch){
case '64': case '91': case '92': case '93': case '94': case '95':
// case '96': case '123': case '124': case '125': case '126': case '127':
index++;
break;

default:
source[index]=ch|32;  // now actual logic to  convert into uppercase
index++;

}



}

}



void main(){
 char source[]="PALASH CHANDEL"; // can supply any input
 toUpperCase(source);
 printf("%s",source);


}