diff options
author | Vojtech Bocek <vbocek@gmail.com> | 2014-03-13 17:36:52 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit> | 2014-04-16 17:51:17 +0200 |
commit | 0b7fe504dc93246957aee38c0d93ea1fa1580fab (patch) | |
tree | 77a4471931591355c383074c480b91d8b71840e5 /twrp-functions.cpp | |
parent | Add additional search path for brightness (diff) | |
download | android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.gz android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.bz2 android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.lz android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.xz android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.zst android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.zip |
Diffstat (limited to '')
-rw-r--r-- | twrp-functions.cpp | 20 |
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 |