Skip to content

Instantly share code, notes, and snippets.

@fabiogaluppo
Created January 1, 2016 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiogaluppo/b3b1d8ad0220ca254548 to your computer and use it in GitHub Desktop.
Save fabiogaluppo/b3b1d8ad0220ca254548 to your computer and use it in GitHub Desktop.
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