没有合适的资源?快使用搜索试试~ 我知道了~
Linux C函数库参考手册(Doc版)
5星 · 超过95%的资源 需积分: 9 37 下载量 122 浏览量
2007-07-18
10:50:46
上传
评论
收藏 2.06MB DOC 举报
温馨提示
试读
64页
Linux C函数库参考手册(Doc版)是我花费好大的功夫才弄到的。跟大家分享了。希望对大家有些帮助。
资源推荐
资源详情
资源评论
Linux C 函数参考
isalnum(测试字符是否为英文或数字)
相关函数 isalpha,isdigit,islower,isupper
表头文件 #include<ctype.h>
定义函数
int isalnum (int c)
函数说明
检查参数 c 是否为英文字母或阿拉伯数字,在标准 c 中相当于使用
(isalpha( c )|| isdigit( c ))做测试。
返回值 若参数 c 为字母或数字,则返回 TRUE,否则返回 NULL( 0 )。
附加说明 此为宏定义,非真正函数。
范例
/* 找出 str 字符串中为英文字母或数字的字符 */
#include < ctype.h>
main()
{
char str[]=”123c@#FDsP[e?”;
int i;
for (i=0;str[i]!=0;i++ )
if ( isalnum(str[i])) printf(“%c is an alphanumeric character\n”,str[i]);
}
执行
1 is an apphabetic character
2 is an apphabetic character
3 is an apphabetic character
c is an apphabetic character
F is an apphabetic character
D is an apphabetic character
s is an apphabetic character
P is an apphabetic character
e is an apphabetic character
isalpha (测试字符是否为英文字母)
相关函数 isalnum,islower,isupper
表头文件
#include<ctype.h>
定义函数 int isalpha (int c)
函数说明
检 查 参 数 c 是 否 为 英 文 字 母 , 在 标 准 c 中 相 当 于 使 用
(isupper(c)||islower(c))做测试。
返回值 若参数 c 为英文字母,则返回 TRUE,否则返回 NULL( 0 )。
附加说明 此为宏定义,非真正函数
范例
/* 找出 str 字符串中为英文字母的字符*/
#include <ctype.h>
main()
{
char str[]=”123c@#FDsP[e?”;
int i;
for (i=0;str[i]!=0;i++)
if(isalpha(str[i])) printf(“%c is an alphanumeric character\n”,str[i]);
}
执行
c is an apphabetic character
F is an apphabetic character
D is an apphabetic character
s is an apphabetic character
P is an apphabetic character
e is an apphabetic character
isascii(测试字符是否为 ASCII 码字符)
相关函数
iscntrl
表头文件
#include <ctype.h>
定义函数 int isascii(int c);
函数说明
检查参数 c 是否为 ASCII 码字符,也就是判断 c 的范围是否在 0 到
127 之间。
返回值
若参数 c 为 ASCII 码字符,则返回 TRUE,否则返回 NULL ( 0
)。
附加说明 此为宏定义,非真正函数。
范例
/* 判断 int i 是否具有对映的 ASCII 码字符 */
#include<ctype.h>
main()
{
int i;
for(i=125;i<130;i++)
if(isascii(i))
printf("%d is an ascii character:%c\n",i,i);
else
printf("%d is not an ascii character\n",i);
}
执行
125 is an ascii character:}
126 is an ascii character:~
127 is an ascii character:
128 is not an ascii character
129 is not an ascii character
iscntrl(测试字符是否为 ASCII 码的控制字符)
相关函数
isascii
表头文件
#include <ctype.h>
定义函数 int iscntrl(int c);
函数说明
检查参数 c 是否为 ASCII 控制码,也就是判断 c 的范围是否在 0 到
30 之间
返回值
若 参 数 c 为 ASCII 控 制 码 , 则 返 回 TRUE , 否 则 返 回
NULL(0)。
附加说明 此为宏定义,非真正函数。
isdigit(测试字符是否为阿拉伯数字)
相关函数
isxdigit
表头文件
#include<ctype.h>
定义函数 int isdigit(int c)
函数说明 检查参数 c 是否为阿拉伯数字 0 到 9。
返回值 若参数 c 为阿拉伯数字,则返回 TRUE,否则返回 NULL(0)。
附加说明 此为宏定义,非真正函数。
范例
/* 找出 str 字符串中为阿拉伯数字的字符 */
#include<ctype.h>
main()
{
char str[]="123@#FDsP[e?";
int i;
for(i=0;str[i]!=0;i++)
if(isdigit(str[i])) printf("%c is an digit character\n",str[i]);
}
执行
剩余63页未读,继续阅读
资源评论
- yoo001232018-10-09这个稳定对不熟悉LINUX C函数库的人有用
ningboweimin
- 粉丝: 35
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功