aboutsummaryrefslogtreecommitdiff
path: root/src/functions.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/functions.hpp')
-rw-r--r--src/functions.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/functions.hpp b/src/functions.hpp
index 94888a3..6b86197 100644
--- a/src/functions.hpp
+++ b/src/functions.hpp
@@ -22,4 +22,14 @@ std::string &trim(std::string &str, const std::string &chars = "\t\n\v\f\r ") {
return ltrim(rtrim(str, chars), chars);
}
+std::vector<std::string> split(const std::string &s, char delimiter) {
+ std::vector<std::string> tokens;
+ std::string token;
+ std::istringstream tokenStream(s);
+ while (std::getline(tokenStream, token, delimiter)) {
+ tokens.push_back(token);
+ }
+ return tokens;
+}
+
#endif // T_FUNCTIONS_HPP