Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) StrToLower

 

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

 

 

 

 

 

Qt CreatorSTL StrToLower

 

#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;
}

 

 

 

 

 

Qt CreatorBoost StrToLower

 

#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);
}

 

 

 

 

 

C++ Builder StrToLower

 

#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;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict