• 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
  • 相关阅读:
    Java学习笔记:异常处理
    Python中那些简单又好用的特性和用法
    UE 交互草实现 不通过RT与距离场的方式
    Ant Design for Figma设计系统组件库 支持变量 非社区版
    unity学习之汇总解答
    数据库Communications link failure
    人工智能基础部分21-神经网络中优化器算法的详细介绍,配套详细公式
    Karl Guttag:我在AWE 2022体验到了哪些有意思的AR眼镜
    Istio-EnvoyFilter配置浅谈
    java基于微信小程序的学习打卡系统 uniapp 小程序
  • 原文地址:https://blog.csdn.net/weixin_60484917/article/details/127658925