String To Lower/Upper in C++

前端 未结 10 1943
挽巷
挽巷 2020-12-08 20:10

What is the best way people have found to do String to Lower case / Upper case in C++?

The issue is complicated by the fact that C++ isn\'t an English only programmi

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 20:36

    #include 
    std::string data = "Abc";
    std::transform(data.begin(), data.end(), data.begin(), ::toupper);
    

    http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/

    Also, CodeProject article for common string methods: http://www.codeproject.com/KB/stl/STL_string_util.aspx

提交回复
热议问题