Create a gist now

Instantly share code, notes, and snippets.

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