diff options
author | louis <louis.braun@gmx.de> | 2014-10-11 16:31:39 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2014-10-11 16:31:39 +0200 |
commit | 0e0f05cfcb72e9d679a6681b9fcabd732856f942 (patch) | |
tree | e79b1772dbdd7fcb116f2298f4ac2f190aefff2d /libcore | |
parent | 04340d11c9c0efb908cce138edde535bc07636d7 (diff) | |
download | vdr-plugin-skindesigner-0e0f05cfcb72e9d679a6681b9fcabd732856f942.tar.gz vdr-plugin-skindesigner-0e0f05cfcb72e9d679a6681b9fcabd732856f942.tar.bz2 |
added support for custom tokens in dislaychannel
Diffstat (limited to 'libcore')
-rw-r--r-- | libcore/helpers.c | 18 | ||||
-rw-r--r-- | libcore/helpers.h | 4 |
2 files changed, 22 insertions, 0 deletions
diff --git a/libcore/helpers.c b/libcore/helpers.c index b4b507a..f24f6e7 100644 --- a/libcore/helpers.c +++ b/libcore/helpers.c @@ -121,6 +121,24 @@ bool FirstFileInFolder(string &path, string &extension, string &fileName) { return false; } +// trim from start +string <rim(string &s) { + s.erase(s.begin(), find_if(s.begin(), s.end(), not1(ptr_fun<int, int>(isspace)))); + return s; +} + +// trim from end +string &rtrim(string &s) { + s.erase(find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(), s.end()); + return s; +} + +// trim from both ends +string &trim(string &s) { + return ltrim(rtrim(s)); +} + + // split: receives a char delimiter; returns a vector of strings // By default ignores repeated delimiters, unless argument rep == 1. vector<string>& splitstring::split(char delim, int rep) { diff --git a/libcore/helpers.h b/libcore/helpers.h index 74ddf94..884738d 100644 --- a/libcore/helpers.h +++ b/libcore/helpers.h @@ -16,6 +16,10 @@ bool FileExists(const string &path, const string &name, const string &ext); bool FolderExists(const string &path); bool FirstFileInFolder(string &path, string &extension, string &fileName); +string <rim(string &s); +string &rtrim(string &s); +string &trim(string &s); + class splitstring : public std::string { std::vector<std::string> flds; public: |