Removing leading and trailing spaces in title/artist/album tags

This commit is contained in:
emeric
2014-08-20 14:09:07 +02:00
parent 9bbff324ec
commit 89d29f4514
3 changed files with 21 additions and 3 deletions
+17
View File
@@ -20,6 +20,23 @@ static inline bool readAs(const std::string& str, T& data)
return iss >> data;
}
std::string
static inline string_trim(const std::string& str,
const std::string& whitespace = " \t")
{
const auto strBegin = str.find_first_not_of(whitespace);
if (strBegin == std::string::npos)
return ""; // no content
const auto strEnd = str.find_last_not_of(whitespace);
const auto strRange = strEnd - strBegin + 1;
return str.substr(strBegin, strRange);
}
std::string
static inline string_to_utf8(const std::string& str)
{