mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Leading and trailing whitespaces are now trimmed when requesting a new custom collection name.
This commit is contained in:
parent
e507335923
commit
527b9321b5
|
@ -554,6 +554,15 @@ std::string CollectionSystemsManager::getValidNewCollectionName(std::string inNa
|
||||||
{
|
{
|
||||||
std::string name = inName;
|
std::string name = inName;
|
||||||
|
|
||||||
|
// Trim leading and trailing whitespaces.
|
||||||
|
name.erase(name.begin(), std::find_if(name.begin(), name.end(), [](char c) {
|
||||||
|
return !std::isspace(static_cast<unsigned char>(c));
|
||||||
|
}));
|
||||||
|
name.erase(std::find_if(name.rbegin(), name.rend(),
|
||||||
|
[](char c) { return !std::isspace(static_cast<unsigned char>(c)); })
|
||||||
|
.base(),
|
||||||
|
name.end());
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
size_t remove = std::string::npos;
|
size_t remove = std::string::npos;
|
||||||
// Get valid name.
|
// Get valid name.
|
||||||
|
|
Loading…
Reference in a new issue