aboutsummaryrefslogtreecommitdiff
path: root/frontend/strings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/strings.cpp')
-rw-r--r--frontend/strings.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/frontend/strings.cpp b/frontend/strings.cpp
index 0d4dee0..bb4a419 100644
--- a/frontend/strings.cpp
+++ b/frontend/strings.cpp
@@ -1,9 +1,10 @@
#include "strings.h"
+#include "print.h"
using namespace std;
void print_string(const char * str) {
- printf("%s\n", wrap_string(str).c_str());
+ lprtf("%s\n", wrap_string(str).c_str());
}
string wrap_string(const char * str) {
@@ -26,3 +27,18 @@ string wrap_string(const char * str) {
return out;
}
+vector<string> split_string(const string & src, const string & delim) {
+ vector<string> out;
+ size_t start = 0;
+ size_t end = src.find(delim);
+
+ while (end != string::npos) {
+ out.push_back(src.substr(start, end - start));
+ start = end + delim.length();
+ end = src.find(delim, start);
+ }
+ out.push_back(src.substr(start));
+
+ return out;
+}
+