• 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
  • 相关阅读:
    零代码工具推荐---HiFlow
    Vue项目的记录(十二)
    企业知识库管理软件介绍,打造企业最强大脑!
    Android 应用开发-实现将公共存储空间内的文件复制到应用的私用存储空间中
    Go 常量为什么只支持基本数据类型?
    代码随想录day56|583. 两个字符串的删除操作72. 编辑距离
    HCIP第十三天
    个性化推荐的工业级实现
    Go-Excelize API源码阅读(十四)——GetSheetFormatPr
    如何将C/C++代码转成webassembly
  • 原文地址:https://blog.csdn.net/weixin_60484917/article/details/127658925