summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-07-03 22:09:22 +0200
committerEthan Yonker <dees_troy@teamw.in>2014-07-09 15:52:18 +0200
commit1b7a31bd65d4e6bf5e337d6280e3d5319d460bef (patch)
treeebe7d27ea5681d1b3c772a7bc2e80025e94435a6 /twrp-functions.cpp
parentColor in the console (diff)
downloadandroid_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.tar
android_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.tar.gz
android_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.tar.bz2
android_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.tar.lz
android_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.tar.xz
android_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.tar.zst
android_bootable_recovery-1b7a31bd65d4e6bf5e337d6280e3d5319d460bef.zip
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 2128c9635..db98a363a 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -299,6 +299,30 @@ std::string TWFunc::Remove_Trailing_Slashes(const std::string& path, bool leaveL
return res;
}
+vector<string> TWFunc::split_string(const string &in, char del, bool skip_empty) {
+ vector<string> res;
+
+ if (in.empty() || del == '\0')
+ return res;
+
+ string field;
+ istringstream f(in);
+ if (del == '\n') {
+ while(getline(f, field)) {
+ if (field.empty() && skip_empty)
+ continue;
+ res.push_back(field);
+ }
+ } else {
+ while(getline(f, field, del)) {
+ if (field.empty() && skip_empty)
+ continue;
+ res.push_back(field);
+ }
+ }
+ return res;
+}
+
#ifndef BUILD_TWRPTAR_MAIN
// Returns "/path" from a full /path/to/file.name