Refactor, test and improve the way we cut too-long messages for IRC
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user