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. ASP.NET Core2集成Office Online Server(OWAS)实现办公文档的在线预览与编辑(支持word\excel\ppt\pdf等格式)

    Office Online Server是微软开发的一套基于Office实现在线文档预览编辑的技术框架(支持当前主流的浏览器,且浏览器上无需安装任何插件,支持word.excel.ppt.pdf等文档 ...

  2. [C#]如何解决修改注册表受限问题(转)

    在项目中添加一个Application Manifest File,名字默认为app.manifest,内容中应该有一行: <requestedExecutionLevellevel=" ...

  3. solr特点五: MoreLikeThis(查找相似页面)

    在 Google 上尝试一个查询,您会注意到每一个结果都包含一个 “相似页面” 链接,单击该链接,就会发布另一个搜索请求,查找出与起初结果类似的文档.Solr 使用MoreLikeThisCompon ...

  4. DbMigration的使用方法

    先打开:工具=>NuGet程序包管理器=>程序包管理器控制台然后输入Enable-Migrations回车然后输入Add-Migration Name回车(这里Name你可以自己命名)最后 ...

  5. C#基础之流程控制语句详解

    C#程序的执行都是一行接一行.自上而下地进行,不遗漏任何代码.为了让程序能按照开发者所设计的流程进行执行,必然需要进行条件判断.循环和跳转等过程,这就需要实现流程控制.C#中的流程控制包含了条件语句. ...

  6. ASP.NET WebAPI 测试文档 (Swagger)

    ASP.NET WebAPI使用Swagger生成测试文档 SwaggerUI是一个简单的Restful API测试和文档工具.简单.漂亮.易用(官方demo).通过读取JSON配置显示API .项目 ...

  7. ({i:0#.w|nt authority\iusr})Sharepoint impersonates the IUSR account and is denied access to resources

    This hotfix makes a new application setting available in ASP.NET 2.0. The new application setting is ...

  8. 调用阿里云API 的demo示例(java/python)

    Java 示例 // 创建DefaultAcsClient实例并初始化 DefaultProfile profile = DefaultProfile.getProfile(vo.getAliRegi ...

  9. VMware 中时间同步设置

    在VMware Workstation 9中安装了一个Ubuntu Server,跑了一段时间之后常发现虚拟机中系统(客户系统)时间要比物理机(宿主系统)中的系统时间慢很多. 几经折腾(部署在VMwa ...

  10. python单引号和双引号的区别

    今天在网上爬虫的时候,很奇怪的发现python的字符串既可以用双引号又可以用单引号,于是就上网百度了一下原因. 原来由于字符串中有可能既有双引号又有单引号,例如: 字符串:demo'1'. 这时候就可 ...