From cb21d37eb766112ba4d8553406b4f1dfe68e7f31 Mon Sep 17 00:00:00 2001 From: Kamil Iskra Date: Thu, 14 Dec 2017 11:14:10 -0600 Subject: [PATCH] Add support for \ and ' Make single-delim-character split() use the string-delims version since I'm too lazy to fix it separately. --- src/utils.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/utils.cpp b/src/utils.cpp index 5c08579..59f11e7 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -23,6 +23,7 @@ vector &split(const string &str_in, char delim, vector &tokens) { +#if 0 std::stringstream ss(str_in); string token; tokens.clear(); @@ -32,6 +33,9 @@ vector &split(const string &str_in, char delim, vector &tokens) tokens.push_back(token); } return tokens; +#endif + string delims(1, delim); + return split(str_in, delims, tokens); } vector &split(const string &str_in, const string &delims, @@ -49,12 +53,37 @@ vector &split(const string &str_in, const string &delims, for(int i=0; i<(int)delims.size(); i++) { for(int j=start; j