Refactor, test and improve the way we cut too-long messages for IRC

This commit is contained in:
louiz’
2016-06-14 20:14:36 +02:00
parent 19bca5c2f2
commit 80d0c19c5a
4 changed files with 28 additions and 9 deletions
+12
View File
@@ -4,3 +4,15 @@ bool to_bool(const std::string& val)
{
return (val == "1" || val == "true");
}
std::vector<std::string> cut(const std::string& val, const std::size_t size)
{
std::vector<std::string> res;
std::string::size_type pos = 0;
while (pos < val.size())
{
res.emplace_back(val.substr(pos, size));
pos += size;
}
return res;
}