diff options
| author | louis <louis.braun@gmx.de> | 2013-09-02 10:58:30 +0200 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2013-09-02 10:58:30 +0200 |
| commit | c9fa7e3832cfa38e18fec25d27eeb229b96068cf (patch) | |
| tree | 0efc166257b5975ee84fcca022c546ed457fbe0c | |
| parent | 3d0bdd00e57551f86862efe20d6a25f1e33de2c7 (diff) | |
| download | vdr-plugin-tvscraper-c9fa7e3832cfa38e18fec25d27eeb229b96068cf.tar.gz vdr-plugin-tvscraper-c9fa7e3832cfa38e18fec25d27eeb229b96068cf.tar.bz2 | |
str_cut now removes ending space
| -rw-r--r-- | tools/stringhelpers.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/stringhelpers.c b/tools/stringhelpers.c index 2eb3c8c..48bbc46 100644 --- a/tools/stringhelpers.c +++ b/tools/stringhelpers.c @@ -12,9 +12,14 @@ string str_replace(const string& search, const string& replace, const string& su //cut string after first "search" string str_cut(const string& search, const string& subject) { string str = subject; + string strCutted = ""; size_t found = str.find_first_of(search); if (found != string::npos) { - return str.substr(0, found); + strCutted = str.substr(0, found); + size_t foundSpace = strCutted.find_last_of(" "); + if ((foundSpace != string::npos) && (foundSpace == (strCutted.size()-1))) { + strCutted = strCutted.substr(0, strCutted.size()-1); + } } - return ""; + return strCutted; } |
