How to Convert a C++ String to Uppercase

前端 未结 6 1752
不知归路
不知归路 2021-02-01 05:34

I need to convert a string in C++ to full upper case. I\'ve been searching for a while and found one way to do it:

#include 
#include 

        
6条回答
  •  太阳男子
    2021-02-01 06:16

    Boost string algorithms:

    #include 
    #include 
    
    std::string str = "Hello World";
    
    boost::to_upper(str);
    
    std::string newstr = boost::to_upper_copy("Hello World");
    

    Convert a String In C++ To Upper Case

提交回复
热议问题