How to convert lowercase letters to uppercase and uppercase letters to lowercase in a string. (ex, AbcdEfG should convert as aBCDeFg)

Answer Posted / agrawal_vivek

easiest way is to use the condition-

for(i=0;s[i]!='';i++)
{
if(s[i]>=65 && s[i]<=90) //Caps ASCII-65-90(60+32=97-----90+32=122)
s[i]=s[i]+32;

if(s[i]>=97 && s[i]<=122) // Small ASCII-97-122(97-32=65-----122-32=90)
s[i]=s[i]-32;
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is implicit cursor in pl sql?

739


What is the syntax and use of the coalesce function?

810


What is the example of procedure?

678


Why is nosql good?

775


How to execute a stored procedure?

754






how to enter characters as hex numbers? : Sql dba

746


Why stored procedure is faster than query?

678


What is the difference between alter trigger and drop trigger statements?

795


Can I learn sql in a week?

753


How sql query is executed?

782


How do you change a value in sql?

738


What is sqlcontext?

714


Can we enter data in a table in design view?

712


what is denormalization. : Sql dba

766


What is pl sql in oracle?

782