From 0b7fe504dc93246957aee38c0d93ea1fa1580fab Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Thu, 13 Mar 2014 17:36:52 +0100 Subject: Add support for actions triggered by key combination Change-Id: I9dfa7de40229f00412d63fc9c1eb3a809a6eb2e6 Signed-off-by: Vojtech Bocek --- twrp-functions.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'twrp-functions.cpp') diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 4551e84b4..fd974d234 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -1142,4 +1142,24 @@ void TWFunc::Fixup_Time_On_Boot() #endif } +std::vector TWFunc::Split_String(const std::string& str, const std::string& delimiter, bool removeEmpty) +{ + std::vector 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 -- cgit v1.2.3