• C++字符串大小写转换


    方法一:

    #include 
    #include 
    using namespace std;
    int main(){
        string str = "JFwxs";
        
        transform(str.begin(),str.end(),str.begin(),::toupper);
        cout<
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    方法二:

    #include 
    #include 
    using namespace std;
    int main(){
        string s;
        cin >> s;
        
    	// 转换为小写
    	_strlwr(s);
    	cout << s << endl;
    
    	// 转换为大写
    	_strupr(s);
    	cout << s << endl;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
  • 相关阅读:
    【二叉树层序遍历 + 置换环】逐层排序二叉树所需的最少操作数目
    前端设计模式基础笔记
    每日刷题Day8
    《奇迹课程》练习手册
    解决mysql中group_concat长度限制的方案
    MySQL 8 中的数据类型转换 | 学习函数CAST() 和 CONVERT()
    解决IDEA中maven无法引进okhttp依赖
    我国跨境电商行业研究报告(2022)
    Spring Security 源码详解
    PGCCC|【PostgreSQL】PCM认证考试大纲#postgresql 认证
  • 原文地址:https://blog.csdn.net/weixin_60484917/article/details/127658925