cctype函数 (字符类型判断)
来源:互联网 发布:ubuntu虚拟机硬盘空间 编辑:程序博客网 时间:2024/06/04 18:01
这些函数都在cctype头文件定义
isalnum(c) 如果C是字母或数字,则为TRUE
isalpha(c) 如果C是字母,返回TRUE
iscntrl(c) 如果C是控制字符,返回TRUE
isdigit(c) 如果C是数字,返回TRUE
isgraph(c) 如果C不是空格,但可以打印,返回TRUE
islower(c) 如果C是小写,返回TRUE
isprint(c) 是可打印的,返回TRUE
ispunct(c) 如果C是标点字符,返回TRUE
isspace(c) 如果C是空白字符,返回TRUE
isupper(c) 如果是大写字符,返回TRUE
isxdigit(c) 如果C是16进制数,返回TRUE
tolower(c) 如果是大写,转化为小写
toupper(c)如果是小写,转化为大写
<span style="font-size:14px;">#include<iostream>#include<string>#include<cctype>using namespace std;int main(){ string s="aeld2o"; for(string::size_type i=0;i<s.size();i++){ if(s[i]>'0'&&s[i]<'9'){ cout<<"有数字"<<endl; break; } } cout<<endl<<endl; for(string::size_type i=0;i<s.length();i++){ if(isalnum(s[i])){ cout<<s[i]<<' '; } } cout<<endl<<endl; for(string::size_type j=0;j<s.size();j++){ if(isalpha(s[j])){ cout<<s[j]<<" "; } } cout<<endl<<endl; for(string::size_type z=0;z<s.size();z++){ if(isdigit(s[z])){ cout<<s[z]<<" "; } } cout<<endl<<endl; for(string::size_type k=0;k<s.size();k++){ if(isalpha(s[k])){ cout<<(char)toupper(s[k])<<" "; } } cout<<endl; return 0;}</span>
0 0
- cctype函数 (字符类型判断)
- cctype中的字符函数
- cctype字符函数
- <cctype> C字符函数
- cctype中的字符函数
- cctype 中的字符函数
- cctype中的字符函数
- C++:cctype中的字符函数
- cctype 常用字符处理函数
- cctype字符函数(大小写数值等操作)
- cctype中的字符函数,头文件#include <cctype>
- 用cctype确定字符的类型
- (八十四)字符函数库cctype
- 【C/C++】cctype中的字符函数
- cctype函数
- 字符检测 cctype(ctype.h)
- cctype头文件中字符处理函数列表
- cctype 定义的函数 (记忆)
- 想成为嵌入式程序员应知道的0x10个基本问题
- TCP/IP详解学习笔记(4)-ICMP协议,ping和Traceroute
- eclipse插件安装——activiti
- 抓包工具Fidder详解(主要来抓取Android中app的请求)
- 差异分析定位Ring 3保护模块
- cctype函数 (字符类型判断)
- 说好的30天直播生死呢?--第二章 为什么是横版格斗?
- UIView、subview的几个基础知识点-iOS开发(实例)
- 巧妙获取结构体大小
- c:forEach 如何输出序号
- Android调用已安装市场,实现软件评分的功能
- Jetty 使用经验整理
- 友盟推送-Code=3000的错误
- java多线程小结,及解决应用挂死的问题