ctype.h / cctype
来源:互联网 发布:国语转粤语软件 编辑:程序博客网 时间:2024/06/01 18:58
ctype.h / cctype - 字符函数库
众所周知,ctype.h为c语言中的一个字符函数库,其中的库函数十分方便,极大的简化了字符确定为大小写字母、数字、标点符号等工作。c++从中定义了cctype函数库,跟C语言的ctype.h差不多。
由此,我们列举出一些常用的cctype字符函数
测试代码:
#include <iostream>//include cctype#include <cctype> //prototypes for character typesusing namespace std;int main(void){ //init a string to test cctypes' fuction char temp[64] = "I am a string. 1 , Just\n is a TeSt."; int i = 0; while (temp[i] != '\0') { if (isalpha(temp[i])) //is word { cout << "I am a word:" << temp[i] << endl; } else if (isalnum(temp[i])) //is number or word { cout << "I am a num:" << temp[i] << endl; } else if (isspace(temp[i])) //is space { cout << "I am a space: ." << endl; } i++; } return 0;}
测试结果(仅供参考):
阅读全文
0 0
- cctype <ctype.h> <cctype>
- isalnum <ctype.h> <cctype>
- isalpha <ctype.h> <cctype>
- iscntrl <ctype.h> <cctype>
- isdigit <ctype.h> <cctype>
- isgraph <ctype.h> <cctype>
- islower <ctype.h> <cctype>
- isprint <ctype.h> <cctype>
- ispunct <ctype.h> <cctype>
- isspace <ctype.h> <cctype>
- isupper <ctype.h> <cctype>
- isxdigit <ctype.h> <cctype>
- toupper <ctype.h> <cctype>
- tolower <ctype.h> <cctype>
- toupper <ctype.h> <cctype>
- ctype.h / cctype
- 头文件 ctype.h/cctype
- cctype (ctype.h)全部看完
- 块级元素与内联元素用法
- (五)Open vSwitch
- 理解Javascript_07_理解instanceof实现原理
- 解决AndroidStudio模拟器卡慢的问题
- notify()与notifyAll()的区别
- ctype.h / cctype
- 面试的一点点感想。
- FTPrep, 75 Sort Colors
- PopupWindow
- process_config解析fstab文件
- redis数据类型
- html --table表格
- [LeetCode]645. Set Mismatch
- numpy 矩阵运算