Add support for actions triggered by key combination
Change-Id: I9dfa7de40229f00412d63fc9c1eb3a809a6eb2e6
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 4551e84..fd974d2 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1142,4 +1142,24 @@
#endif
}
+std::vector<std::string> TWFunc::Split_String(const std::string& str, const std::string& delimiter, bool removeEmpty)
+{
+ std::vector<std::string> res;
+ size_t idx = 0, idx_last = 0;
+
+ while(idx < str.size())
+ {
+ idx = str.find_first_of(delimiter, idx_last);
+ if(idx == std::string::npos)
+ idx = str.size();
+
+ if(idx-idx_last != 0 || !removeEmpty)
+ res.push_back(str.substr(idx_last, idx-idx_last));
+
+ idx_last = idx + delimiter.size();
+ }
+
+ return res;
+}
+
#endif // ndef BUILD_TWRPTAR_MAIN