Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
inline bool is_ascii_upper(char ch) { return 'A' <= ch && ch <= 'Z'; }
void lowercase(std::istream& istr)
{
std::string s;
while (std::getline(istr, s, '\n'))
{
for (char& ch : s)
{
if (is_ascii_upper(ch))
{
ch = ch - 'A' + 'a';
}
}
std::cout << s << "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment