Convert a String In C++ To Upper Case

后端 未结 30 1514
一个人的身影
一个人的身影 2020-11-22 05:25

How could one convert a string to upper case. The examples I have found from googling only have to deal with chars.

30条回答
  •  情歌与酒
    2020-11-22 05:59

    Without using any libraries:

    std::string YourClass::Uppercase(const std::string & Text)
    {
        std::string UppperCaseString;
        UppperCaseString.reserve(Text.size());
        for (std::string::const_iterator it=Text.begin(); it(0x20)) : *it);
        }
        return UppperCaseString;
    }
    

提交回复
热议问题