Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
Example 1:
Input: "Hello" Output: "hello"
Example 2:
Input: "here" Output: "here"
Example 3:
Input: "LOVELY" Output: "lovely"
代码如下:
char* toLowerCase(char* str) {
int a=strlen(str);
int i,j,k;
for(i=0;i<a;i++)
{
if(str[i]>='a'&&str[i]<='z')
continue;
else if(str[i]>='A'&&str[i]<='Z')
str[i]=str[i]+32;
else
continue;
}
return str;
}