c语言检查字符函数_如何在C中检查字符值

c语言检查字符函数

When working in C, we can use the ctype.h standard library set of functions to check the value of a char type variable.

在C语言中工作时,我们可以使用ctype.h标准库函数集来检查char类型变量的值。

We have access to several useful checks:

我们可以访问一些有用的检查:

  • isalnum() checks if a character is alphanumeric

    isalnum()检查字符是否为字母数字

  • isalpha() checks if a character is alphabetic

    isalpha()检查字符是否为字母

  • iscntrl() checks if a character is a control character

    iscntrl()检查字符是否为控制字符

  • isdigit() checks if a character is a digit

    isdigit()检查字符是否为数字

  • isgraph() checks if a character is a printable ASCII character (but not a space)

    isgraph()检查字符是否为可打印的ASCII字符 (但不能为空格)

  • islower() checks if a character is lowercase

    islower()检查字符是否为小写

  • isprint() checks if a character is a printable ASCII character

    isprint()检查字符是否为可打印的ASCII字符

  • ispunct() checks if a character is a punctuation character (a printable char, not a space, not alphanumeric)

    ispunct()检查字符是否为标点符号(可打印字符,而不是空格,不是字母数字)

  • isspace() checks if a character is a whitespace character (see more later)

    isspace()检查字符是否为空格字符(请参阅稍后)

  • isupper() checks if a character is uppercase

    isupper()检查字符是否为大写

  • isxdigit() checks if a character is an hexadecimal digit (0-F)

    isxdigit()检查字符是否为十六进制数字( 0 - F )

I mentioned that isspace() checks if a character is a whitespace character. What is a whitespace character?

我提到过isspace()检查字符是否为空白字符。 什么是空白字符?

  • Horizontal tab (HT), '\t', character 9 of the ASCII table

    水平制表符(HT), '\t' ,ASCII表的字符9

  • Vertical tab (VT), '\v', character 11 of the ASCII table

    垂直制表符(VT), '\v' ,ASCII表的字符11

  • Form Feed (FF), '\f', character 12 of the ASCII table

    换页(FF), '\f' ,ASCII表的字符12

  • Carriage Return (CR), '\r', character 13 of the ASCII table

    回车符(CR), '\r' ,ASCII表的字符13

  • Space, ' ', character 32 of the ASCII table

    ASCII表的空格' ' ,字符32

  • New line, '\n'

    换行'\n'

翻译自: https://flaviocopes.com/c-check-char-value/

c语言检查字符函数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值