将字符串中的大写字母变成小写字母
生活随笔
收集整理的這篇文章主要介紹了
将字符串中的大写字母变成小写字母
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/*字符串中大寫字母變成小寫,其余字符不變*/#include <stdio.h>
#include <string.h>char* mystrlwr(char *s)
{char *scopy = s;while (*s) {if (*s >= 'A' && *s <= 'Z') {*s = *s + 'a' - 'A';}s++;}return scopy;
}char *mysed_strlwr(char *s)
{char *scopy = s;while (*s) {if (isupper(*s)) {*s = tolower(*s);}s++;}return scopy;
}int main(void)
{char s[] = "HeLLowoRLD"; printf("%s\n", mystrlwr(s)); printf("%s\n", mysed_strlwr(s));return 0;
}
轉載于:https://www.cnblogs.com/helloweworld/archive/2012/12/10/2810969.html
總結
以上是生活随笔為你收集整理的将字符串中的大写字母变成小写字母的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vijos p1347(最大乘积(整数划
- 下一篇: [for循环之等腰三角形]