• 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
  • 相关阅读:
    Android 13 骁龙相机点击录像流程分析
    性能测试 —— Jmeter 常用三种定时器
    Python调用OpenCV接口播放本地视频文件、本地和网络摄像头
    1、javaweb学习知识简析
    结构体内存对齐详解
    【AI理论学习】语言模型:掌握BERT和GPT模型
    定点小数和定点整数的取值范围
    zblog插件大全-zblog免费插件
    【深度学习】(四)目标检测——上篇
    工业镜头接口类型
  • 原文地址:https://blog.csdn.net/weixin_60484917/article/details/127658925