#include <algorithm>
#include <cctype>
#include <string>
std::string data = "Abc";
std::transform(data.begin(), data.end(), data.begin(),
[](unsigned char c){ return std::tolower(c); });
You're not going to get away with not going over each character.
Otherwise, there is no way to tell whether the character is lowercase or uppercase.
If you despise tolower(), here's a customised ASCII-only solution I don't recommend:
char asciitolower(char in) {
if (in <= 'Z' && in >= 'A')
return in - ('Z' - 'z');
return in;
}
std::transform(data.begin(), data.end(), data.begin(), asciitolower);
Tolower() can only do single-byte character substitutions, which is inconvenient for many scripts, notably those that use a multi-byte encoding like UTF-8.