1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Merge branch 'issue_#8' into 'master'

Issue #8 Modified Sanitize

See merge request Mr_Goldberg/goldberg_emulator!11
This commit is contained in:
Goldberg 2019-06-17 11:35:02 +00:00
commit 0543229b3e

View file

@ -23,11 +23,10 @@ std::string Settings::sanitize(std::string name)
name.erase(std::remove(name.begin(), name.end(), '\n'), name.end()); name.erase(std::remove(name.begin(), name.end(), '\n'), name.end());
name.erase(std::remove(name.begin(), name.end(), '\r'), name.end()); name.erase(std::remove(name.begin(), name.end(), '\r'), name.end());
for (int i = 0; i < name.size(); ++i) { for (auto& i : name)
if (name[i] >= 'a' && name[i] <= 'z') continue; {
if (name[i] >= 'A' && name[i] <= 'Z') continue; if (!isprint(i))
if (name[i] >= '0' && name[i] <= '9') continue; i = ' ';
name[i] = ' ';
} }
return name; return name;