C 标准库 - ctype.h

This header declares a set of functions to classify and transform individual characters.

  • These functions take the int equivalent of one character as parameter and return an int that can either be another character or a value representing a boolean value: an int value of 0 means false, and an int value different from 0 represents true.
  • C 标准库的 ctype.h 头文件提供了一些函数,可用于测试和映射字符。

    这些函数接受 int 作为参数,它的值必须是 EOF 或表示为一个无符号字符。

    如果参数 c 满足描述的条件,则这些函数返回非零(true)。如果参数 c 不满足描述的条件,则这些函数返回零。

函数


//Character classification functions
//They check whether the character passed as parameter belongs to a certain category:
int isalnum(int c)
检查所传的字符是否是字母和数字。 int isalpha(int c)
检查所传的字符是否是字母。 int isblank (int c)
Check if character is blank int iscntrl(int c)
检查所传的字符是否是控制字符。 int isdigit(int c)
检查所传的字符是否是十进制数字。 int isgraph(int c)
检查所传的字符是否有图形表示法。 int islower(int c)
检查所传的字符是否是小写字母。 int isprint(int c)
检查所传的字符是否是可打印的。 int ispunct(int c)
检查所传的字符是否是标点符号字符。 int isspace(int c)
检查所传的字符是否是空白字符。 int isupper(int c)
检查所传的字符是否是大写字母。 int isxdigit(int c)
检查所传的字符是否是十六进制数字。 //Character conversion functions
int tolower(int c)
把大写字母转换为小写字母。 int toupper(int c)
把小写字母转换为大写字母。

字符类

数字 (Digits)

  • A set of whole numbers { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
  • 完整的数字集合 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }

十六进制数字 (Hexadecimal digits)

  • This is the set of { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f }
  • 集合 { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f }

小写字母 (Lowercase letters)

  • This is a set of { a b c d e f g h i j k l m n o p q r s t u v w x y z }
  • 集合 { a b c d e f g h i j k l m n o p q r s t u v w x y z }

大写字母 (Uppercase letters)

  • A set of whole numbers {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }
  • 集合 {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }

字母 (Letters)

  • This is a set of lowercase letters and uppercase letters
  • 小写字母和大写字母的集合

字母数字字符 (Alphanumeric characters)

  • This is a set of Digits, Lowercase letters and Uppercase letters
  • 数字、小写字母和大写字母的集合

标点符号字符 (Punctuation characters)

  • This is a set of ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ ] ^ _ ` { | } ~
  • 集合 ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~

图形字符 (Graphical characters)

  • This is a set of Alphanumeric characters and Punctuation characters.
  • 字母数字字符和标点符号字符的集合

空格字符 (Space characters)

  • This is a set of Alphanumeric characters and Punctuation characters.
  • 制表符、换行符、垂直制表符、换页符、回车符、空格符的集合。

可打印字符

  • This is a set of Alphanumeric characters, Punctuation characters and Space characters.
  • 字母数字字符、标点符号字符和空格字符的集合。

控制字符 (Control characters)

  • In ASCII, these characters have octal codes 000 through 037, and 177 (DEL).
  • 在 ASCII 编码中,这些字符的八进制代码是从 000 到 037,以及 177(DEL)。

空白字符 (Blank characters)

  • These are space and tab.
  • 包括空格符和制表符。

字母字符 (Alphabetic characters)

  • This is a set of Lowercase letters and Uppercase letters.
  • 小写字母和大写字母的集合。

ASCII

 0 -  8	       0x00-0x08	控制码 (NUL等)
9 - 9 0x09 制表符 (\t)
10 - 13 0x0A-0x0D 空白符 (\n, \v, \f, \r)
14 - 31 0x0E-0x1F 控制码
32 - 32 0x20 空格
33 - 47 0x21-0x2F !"#$%&'()*+,-./
48 - 57 0x30-0x39 0123456789
58 - 64 0x3a-0x40 :;<=>?@
65 - 70 0x41-0x46 ABCDEF
71 - 90 0x47-0x5A GHIJKLMNOPQRSTUVWXYZ
91 - 96 0x5B-0x60 [\]^_`
97 -102 0x61-0x66 abcdef
103-122 0x67-0x7A ghijklmnopqrstuvwxyz
123-126 0x7B-0x7E {|}~
127 0x7F 退格符 (DEL)

参考文章

C 标准库 - ctype.h的更多相关文章

  1. C标准库<ctype.h>实现

    本文地址:http://www.cnblogs.com/archimedes/p/c-library-ctype.html,转载请注明源地址. 1.背景知识 ctype.h是C标准函数库中的头文件,定 ...

  2. C 标准库 - ctype.h之iscntrl 使用

    iscntrl int iscntrl ( int c ); Check if character is a control character 检查给定字符是否为控制字符,即编码 0x00-0x1F ...

  3. C 标准库 - ctype.h之isalpha使用

    isalpha int isalpha ( int c ); Checks whether c is an alphabetic letter. 检查给定字符是否字母字符,即是大写字母( ABCDEF ...

  4. C 标准库 - ctype.h之isalnum使用

    isalnum int isalnum ( int c ); Checks whether c is either a decimal digit or an uppercase or lowerca ...

  5. C 标准库 - string.h

    C 标准库 - string.h This header file defines several functions to manipulate C strings and arrays. stri ...

  6. C 标准库 - <assert.h>

    C 标准库 - <assert.h> 简介 C 标准库的 assert.h头文件提供了一个名为 assert 的宏,它可用于验证程序做出的假设,并在假设为假时输出诊断消息. 已定义的宏 a ...

  7. C 标准库 - <stdarg.h>

    C 标准库 - <stdarg.h> 简介 stdarg.h 头文件定义了一个变量类型 va_list 和三个宏,这三个宏可用于在参数个数未知(即参数个数可变)时获取函数中的参数. 可变参 ...

  8. C 标准库 - <signal.h>

    C 标准库 - <signal.h> 简介 signal.h 头文件定义了一个变量类型 sig_atomic_t.两个函数调用和一些宏来处理程序执行期间报告的不同信号. 库变量 下面是头文 ...

  9. C 标准库 - <setjmp.h>

    C 标准库 - <setjmp.h> 简介 setjmp.h 头文件定义了宏 setjmp().函数 longjmp() 和变量类型 jmp_buf,该变量类型会绕过正常的函数调用和返回规 ...

随机推荐

  1. [Elixir004]通过环境变量(Environment Variables)来管理config

    在elixir的config中我们有时会使用的到一些不想暴露出来的配置项,常用的作法是如Phoenix #config/prod.exs use Mix.Config ... # Finally im ...

  2. 开源应用框架BitAdminCore重构再思考

    索引 NET Core应用框架之BitAdminCore框架应用篇系列 框架演示:https://www.bitadmincore.com 框架源码:https://github.com/chenyi ...

  3. 控制 MediaElement(播放、暂停、停止、音量和速度)

    控制 MediaElement(播放.暂停.停止.音量和速度) WPF中对于多媒体的支持非常完整,一般都是通过MediaElement来实现的. http://msdn.microsoft.com/z ...

  4. HDP Spark2 HIVE3.1 的问题

    HDP 上安装了 Hive3.1 和 Spark2, 提交 Spark 作业时,报找不到 Hive 中表的问题 但是查一了下 hive 表,明明是存在这个表的.查看日志,注意到如下的一段日志. 没修改 ...

  5. robot framework学习笔记之一 资源文件(Resource)和外部资源(External Resources)

    一.资源文件(Resource) 测试套件主要是存放测试案例,资源文件主要是用来存放用户关键字. 添加资源    在目录型的Project/Test Suite下单击鼠标右键,选择『New Resou ...

  6. 如何查看mysql 默认端口号和修改端口号

    http://blog.itpub.net/26148431/viewspace-1466379/ 1,登录mysql 2,使用命令show global variables like 'port'; ...

  7. 在 iOS 中使用 iconfont

    如何使用自定义字体 在讲icon font之前,首先先来看看普通自定义字体是如何在ios中使用的,两个原理是一样的.这里以KaushanScript-Regular为例:   Step 1: 导入字体 ...

  8. POJ 2192

    #include <iostream> #include <string> #define MAXN 500 using namespace std; bool dp[MAXN ...

  9. 47.ActiveMQ集群

    (声明:本文非EamonSec原创) 使用ZooKeeper实现的Master-Slave实现方式,是对ActiveMQ进行高可用的一种有效的解决方案,高可用的原理:使用ZooKeeper(集群)注册 ...

  10. Tomcat 基础优化

    作者:北京运维 本文档是身边一些朋友.技术大佬之前分享的一些笔记,记录了 Tomcat 优化方法,笔记较多而且比较杂乱,经过整理.分类我个人觉得大致可以从以下几个方面优化 Tomcat: Tomcat ...