Skip to content

Latest commit

 

History

History
89 lines (50 loc) · 3.4 KB

CppStrToLower.md

File metadata and controls

89 lines (50 loc) · 3.4 KB

 

 

 

 

 

 

std::string convert code snippet to convert a std::string to lower case.

 

 

 

 

 

 


#include <algorithm> #include <cctype> #include <string> ///StrToLower converts a std::string to lowercase //From http://www.richelbilderbeek.nl/CppStrToLower.htm const std::string StrToLower(std::string s) {   std::transform(s.begin(), s.end(), s.begin(),std::ptr_fun<int,int>(std::tolower));   return s; }

 

 

 

 

 

 


#include <boost/algorithm/string.hpp> ///StrToLower converts a std::string to lowercase //From http://www.richelbilderbeek.nl/CppStrToLower.htm const std::string StrToLower(const std::string& s) {   return boost::algorithm::to_lower_copy(s); }

 

 

 

 

 

 


#include <algorithm> #include <cctype> #include <string> ///StrToLower converts a std::string to lowercase //From http://www.richelbilderbeek.nl/CppStrToLower.htm const std::string StrToLower(std::string s) {   std::transform(s.begin(), s.end(), s.begin(),std::ptr_fun(std::tolower));   return s; }