aboutsummaryrefslogtreecommitdiff
path: root/frontend/strings.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-28 15:41:35 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-28 15:41:35 +0100
commit3562802cacc8dbd0c155146acfdb8d04c6440009 (patch)
treef2139c64c6713d1c59df4b8601c11fca52fa62f5 /frontend/strings.cpp
parenta070c649ddbe70a22f6265b9f5b48f6bde7eac08 (diff)
implement transcript-style log
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;
+}
+