<cctype> (ctype.h)

Character handling functions

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

Functions

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 0represents true.



There are two sets of functions:

Character classification functions

They check whether the character passed as parameter belongs to a certain category:

isalnum
Check if character is alphanumeric (function )
isalpha
Check if character is alphabetic (function )
isblank 
Check if character is blank (function )
iscntrl
Check if character is a control character (function )
isdigit
Check if character is decimal digit (function )
isgraph
Check if character has graphical representation (function )
islower
Check if character is lowercase letter (function )
isprint
Check if character is printable (function )
ispunct
Check if character is a punctuation character (function )
isspace
Check if character is a white-space (function )
isupper
Check if character is uppercase letter (function )
isxdigit
Check if character is hexadecimal digit (function )

Character conversion functions

Two functions that convert between letter cases:

tolower
Convert uppercase letter to lowercase (function )
toupper
Convert lowercase letter to uppercase (function )

For the first set, here is a map of how the original 127-character ASCII set is considered by each function (an x indicates that the function returns true on that character)

ASCII values characters iscntrl isblank isspace isupper islower isalpha isdigit isxdigit isalnum ispunct isgraph isprint
0x00 .. 0x08 NUL, (other control codes) x                      
0x09 tab ('\t') x x x                  
0x0A .. 0x0D (white-space control codes:'\f','\v','\n','\r') x   x                  
0x0E .. 0x1F (other control codes) x                      
0x20 space (' ')   x x                 x
0x21 .. 0x2F !"#$%&'()*+,-./                   x x x
0x30 .. 0x39 0123456789             x x x   x x
0x3a .. 0x40 :;<=>?@                   x x x
0x41 .. 0x46 ABCDEF       x   x   x x   x x
0x47 .. 0x5A GHIJKLMNOPQRSTUVWXYZ       x   x     x   x x
0x5B .. 0x60 [\]^_`                   x x x
0x61 .. 0x66 abcdef         x x   x x   x x
0x67 .. 0x7A ghijklmnopqrstuvwxyz         x x     x   x x
0x7B .. 0x7E {|}~                   x x x
0x7F (DEL) x                      

The characters in the extended character set (above 0x7F) may belong to diverse categories depending on the locale and the platform. As a general rule, ispunctisgraph and isprint return
true on these for the standard C locale on most platforms supporting extended character sets.

字符函数库 cctype的更多相关文章

  1. 学习笔记二十三——字符函数库cctype【转】

    本文转载自: 字符函数库cctype 在头文件cctype(ctype.h)中定义了一些函数原型,可以简化输入确定字符是否为大写字母.数字.标点符号等工作. 例如: 如果ch是一个字母,则isalph ...

  2. 循环 与 分支语句 和 字符函数库cctype 文件简单处理

    循环 for循环 while循环 do  while循环 通常,入口条件循环比出口条件循环好,因为循环开始前对条件进行检查 c++11基于范围的for循环    对数组(或容器类,如:vector和a ...

  3. C++学习笔记之字符函数库cctype

    C++从C语言继承了一个与字符相关的.非常方便的函数软件包,它可以简化诸如确定字符是否为大写字母.数字.标点符号等工作,这些函数原型是在头文件cctype(老式风格ctype.h)中定义的. 下表对这 ...

  4. 字符函数库 - cctype 和 climits 中的符号常量

    一. C++从C语言中继承一个与字符相关的.非常方便的函数软件包,他可以简化诸如确定字符是否为大写字母‘数字.标点符号等工作,这些函数的原型在头文件cctype(老式的为ctype.h)中定义的.例如 ...

  5. python函数库及函数标准库

    一.系统库提供的内部函数 字符函数库: 1)str.islower() :字符串是否全部是小写 2)str.isspace() :字符串是否为空 3)help(str):查询字符串函数库 4)str. ...

  6. PHP移动互联网开发笔记(5)——基础函数库

    一.数学函数库 ● floor 舍一取整(向下取整) float floor (float $value); <?php echo(floor(0.60)."<br>&qu ...

  7. cctype头文件(字符处理库)的使用

    C++ 中cctype头文件的使用 头文件cctype(字符处理库)中定义了有关字符判断与处理的库函数,使用前要包含头文件: #include <cctype> using namespa ...

  8. PHP用mb_string函数库处理与windows相关中文字符

    昨天想批处理以前下载的一堆文件,把文件里的关键内容用正则匹配出来,集中处理.在操作文件时遇到一个问题,就是windows操作系统中的编码问题. 我们都知道windows中(当然是中文版),文件名和文件 ...

  9. 【C++实现python字符串函数库】二:字符串匹配函数startswith与endswith

    [C++实现python字符串函数库]字符串匹配函数startswith与endswith 这两个函数用于匹配字符串的开头或末尾,判断是否包含另一个字符串,它们返回bool值.startswith() ...

随机推荐

  1. LINUX nfs服务

    1.什么是NFS(Network FileSystem)  NFS 就是 Network FileSystem 的缩写,最早之前是由 Sun 所发展出来的.他最大的功能就是可以透过网络,让不同的机器. ...

  2. Ajax中参数带有html格式的 传入后台保存【一】

    因业务需求  要讲如下编辑器中带有样式的数据传入数据库保存 第一种方法  json格式传入 $(".privilegezn_page .btn_ok").click(functio ...

  3. 简单的Socket通信

    Socket简介 Socket又称"套接字",应用程序通常通过"套接字"向网络发出请求或者应答网络请求. 服务端步骤: • socket:创建服务器socket ...

  4. ural 1049. Brave Balloonists(标准分解式,数论)

    1049. Brave Balloonists Time limit: 2.0 secondMemory limit: 64 MB Ten mathematicians are flying on a ...

  5. 如何直观的解释back propagation算法?

    转自:知乎-https://www.zhihu.com/question/27239198 作者:匿名用户链接:https://www.zhihu.com/question/27239198/answ ...

  6. nginx启动,重启,关闭

    1.nginx启动: a.     /usr/path/sbin/nginx -c [/etc/path/nginx.conf] 中括号中为指定加载的配置文件,不指定则加载默认配置文件 b.     ...

  7. oracle行转列函数

  8. MapReduce,DataJoin,链接多数据源

    主要介绍用DataJoin类来链接多数据源,先看一下例子,假设二个数据源customs和orders customer ID       Name      PhomeNumber 1         ...

  9. mave 安装本地jar包到maven库

    Maven 安装 JAR 包的命令是: mvn install:install-file -Dfile=本地jar包的位置 -DgroupId=groupId -DartifactId=artifac ...

  10. Java类和类成员的访问权限修饰符

    一:访问修饰符: 1.省略访问修饰符 具有默认的访问特性,即具有包访问特性,只能被同一个包中的类使用. 2.public访问修饰符 用于说明类和类的成员的访问权限.这种类叫公有类.在一个文件中只能有一 ...