summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--twrp-functions.cpp20
1 files changed, 20 insertions, 0 deletions
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<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