added support for custom tokens in dislaychannel

This commit is contained in:
louis
2014-10-11 16:31:39 +02:00
parent 04340d11c9
commit 0e0f05cfcb
16 changed files with 132 additions and 4 deletions

View File

@@ -121,6 +121,24 @@ bool FirstFileInFolder(string &path, string &extension, string &fileName) {
return false;
}
// trim from start
string &ltrim(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) {

View File

@@ -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 &ltrim(string &s);
string &rtrim(string &s);
string &trim(string &s);
class splitstring : public std::string {
std::vector<std::string> flds;
public: