tolower function for C++ strings

前端 未结 6 996
误落风尘
误落风尘 2020-12-11 01:19

Is there an inbuilt function to convert C++ string from upper case letters to lowercase letters ? If not converting it to cstring and using tolower on each char is the only

6条回答
  •  长情又很酷
    2020-12-11 02:02

    Like ereOn says: std::transform(str.begin(), str.end(), str.begin(), std::tolower );

    Or via for_each: std::for_each(str.begin(), str.end(), std::tolower );

    Transform is probably better of the two.

提交回复
热议问题