logic: Trim lines and remove empty ones when checking license key
This commit is contained in:
@@ -168,4 +168,11 @@ namespace utility
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string trim(const std::string &str)
|
||||
{
|
||||
auto wsfront = std::find_if_not(str.begin(), str.end(), [](int c){ return std::isspace(c); });
|
||||
auto wsback = std::find_if_not(str.rbegin(), str.rend(), [](int c){ return std::isspace(c); }).base();
|
||||
return (wsback <= wsfront ? std::string() : std::string(wsfront, wsback));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user