• 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
  • 相关阅读:
    全面解析‘msvcp140.dll丢失的解决方法’这个问题
    《机械原理》上 学后感
    Oracle数据库:oracle组函数,聚合函数,多行函数,avg,sum,min,max,count,group by,having
    网络安全(黑客)——自学2024
    灵性图书馆:好书推荐-《奥修传》
    自建应用第三方域名被拦截,如何解决?
    Springboot数据库访问JPA
    WebRTC-NACK、Pacer和拥塞控制和FEC
    CSS padding(填充)
    河北首家城商行传统核心业务国产化,TDSQL突破三“最”为秦皇岛银行保驾护航
  • 原文地址:https://blog.csdn.net/weixin_60484917/article/details/127658925