C和指针之字符操作(<ctype.h>)
发布日期:2021-06-29 14:10:38 浏览次数:2 分类:技术文章

本文共 545 字,大约阅读时间需要 1 分钟。

1、字符操作

在头文件<ctype.h>中
1、字符分类
islower(int a) 是否是小写
isupper(int a) 是否是大写
 
 
2、字符转换
int tolower(int ch)转换成小写
int woupper(int ch)转换成大写
 
 
 
 
 
 

2、测试Demo

#include 
#include
int main(){ //字符分类 char a = 'A'; printf("islower(%c) is %d\n", a, islower(a)); char b = 'B'; printf("isupper(%c) is %d\n", b, isupper(b)); char c = 'C'; //是不是字母 printf("isalpha(%c) is %d\n", c, isalpha(c)); //字符转换 char d = 'D'; printf("tolower(%c) is %c\n", d, tolower(d)); char e = 'e'; printf("toupper(%c) is %c\n", e, toupper(c)

转载地址:https://chenyu.blog.csdn.net/article/details/78578471 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:linux之用echo输入数据到文本末尾以及用open ssl命令在证书文件里面获取公钥
下一篇:C和指针之字符串strtok函数

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月16日 00时25分57秒