summaryrefslogtreecommitdiff
path: root/louloulibs/utils/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'louloulibs/utils/string.cpp')
-rw-r--r--louloulibs/utils/string.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/louloulibs/utils/string.cpp b/louloulibs/utils/string.cpp
index 3977feb..7ed1aa3 100644
--- a/louloulibs/utils/string.cpp
+++ b/louloulibs/utils/string.cpp
@@ -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;
+}