• 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
  • 相关阅读:
    华为设备ACL配置命令
    工程监测仪器无线振弦采集仪高低温试验箱测试原理
    【ijkplayer】解码流程梳理(三)
    [AutoSAR系列] 1.3 AutoSar 架构
    观察者模式——解决解耦的钥匙
    Jeecg-boot中的popup弹框使用(基于表p_user_info),表格显示添加其它关联表的字段
    国庆假期作业day2
    CSP-J第二轮试题-2020年-4题
    互联网Java工程师面试题·Java 面试篇·第一弹
    打开、读取以及关闭目录[ opendir()、 readdir()和 closedir() ]
  • 原文地址:https://blog.csdn.net/weixin_60484917/article/details/127658925