函数名: strupr功 能: 将串中的小写字母转换为大写字母用 法: char *strupr(char *str);程序例:#include <stdio.h> #include <string.h> int main(void)
{ char *string = "abcdefghijklmnopqrstuvwxyz", *ptr;/* converts string to upper case characters */ ptr = strupr(string);printf("%sn", ptr);return 0;}
函数名: swab功 能: 交换字节用 法: void swab (char *from, char *to, int nbytes);程序例:#include <stdlib.h> #include <stdio.h> #include <string.h> char source[15] = "rFna koBlrna d";char target[15];int main(void)
{ swab(source, target, strlen(source));printf("This is target: %sn", target);return 0;}
PS:isalpha()是字符函数,不是字符串函数,
isalpha
原型:extern int isalpha(int c);
用法:#include <ctype.h>
功能:判断字符c是否为英文字母
说明:当c为英文字母a-z或A-Z时,返回非零值,否则返回零。
举例:
// isalpha.c
#include <syslib.h> #include <ctype.h> #include <stdio.h>
main()
{ int c;
clrscr(); // clear screen printf("Press a key");for(;;)
{ c=getchar();clrscr();printf("%c: %s letter",c,isalpha(c)?"is":"not");} return 0; // just to avoid warnings by compiler }
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-33642-12.html
请注意是进入人造岛礁