Remove leading and trailing spaces from tags.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-05-22 15:13:10 +02:00
parent f7faef4d31
commit 8275db6687
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 10 additions and 2 deletions

View File

@ -99,8 +99,16 @@ const options parse_options(const int argc, const char *argv[])
while (pos_end != std::string::npos)
{
pos_end = tags.find(',', pos_start);
opts.tags.push_back
(tags.substr(pos_start, pos_end - pos_start));
string buffer = tags.substr(pos_start, pos_end - pos_start);
while (*buffer.begin() == ' ') // Remove leading spaces.
{
buffer.erase(buffer.begin());
}
while (*buffer.rbegin() == ' ') // Remove trailing spaces.
{
buffer.erase(buffer.end() - 1);
}
opts.tags.push_back(buffer);
pos_start = pos_end + 1;
}
}