Convert a String In C++ To Upper Case

后端 未结 30 1893
一个人的身影
一个人的身影 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 06:02

    I use this solution. I know you're not supposed to modify that data area.... but I think that's mostly for buffer overrun bugs and null character.... upper casing things isn't the same.

    void to_upper(const std::string str) {
        std::string::iterator it;
        int i;
        for ( i=0;i

提交回复
热议问题