C Standard Library: 2 Character Class Tests: <ctype.h>

本文介绍了&lt;ctype.h&gt;头文件中定义的各种字符测试和转换函数。这些函数用于检查字符是否为字母、数字等,并提供了将字符从一种大小写转换为另一种的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2 Character Class Tests: <ctype.h>

The header <ctype.h> declares functions for testing characters. For each function, the
argument list is an int, whose value must be EOF or representable as an unsigned char, and
the return value is an int. The functions return non-zero (true) if the argument c satisfies the
condition described, and zero if not.
isalnum(c) isalpha(c) or isdigit(c) is true
isalpha(c) isupper(c) or islower(c) is true
iscntrl(c) control character
isdigit(c) decimal digit
isgraph(c) printing character except space
islower(c) lower-case letter
isprint(c) printing character including space
ispunct(c) printing character except space or letter or digit
isspace(c) space, formfeed, newline, carriage return, tab, vertical tab
isupper(c) upper-case letter
isxdigit(c) hexadecimal digit
In the seven-bit ASCII character set, the printing characters are 0x20 (' ') to 0x7E ('-');
the control characters are 0 NUL to 0x1F (US), and 0x7F (DEL).
In addition, there are two functions that convert the case of letters:
int tolower(c) convert c to lower case
int toupper(c) convert c to upper case
If c is an upper-case letter, tolower(c) returns the corresponding lower-case letter,
toupper(c) returns the corresponding upper-case letter; otherwise it returns c.

转载于:https://www.cnblogs.com/freewater/archive/2013/03/21/2972580.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值