tolower

来源:互联网 发布:snmpwalk 命令 端口 编辑:程序博客网 时间:2024/05/13 17:21
头文件:#include <stdlib.h>

定义函数:int tolower(int c);

函数说明:若参数 c 为大写字母则将该对应的小写字母返回。

返回值:返回转换后的小写字母,若不须转换则将参数c 值返回。

范例:将s 字符串内的大写字母转换成小写字母。
复制纯文本新窗口
  1. #include <ctype.h>
  2. main(){
  3. char s[] = "aBcDeFgH12345;!#$";
  4. int i;
  5. printf("before tolower() : %s\n", s);
  6. for(i = 0; i < sizeof(s); i++)
  7. s[i] = tolower(s[i]);
  8. printf("after tolower() : %s\n", s);
  9. }
#include <ctype.h>main(){    char s[] = "aBcDeFgH12345;!#$";    int i;    printf("before tolower() : %s\n", s);    for(i = 0; i < sizeof(s); i++)        s[i] = tolower(s[i]);    printf("after tolower() : %s\n", s);}

执行结果:
before tolower() : aBcDeFgH12345;!#$
after tolower() : abcdefgh12345;!#$
0 0
原创粉丝点击