mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
Change cleanString() to convert invalid chars to underscores
This commit is contained in:
parent
3e8baa5b04
commit
ae6ec3b1b8
@ -105,11 +105,13 @@ int main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
|
|
||||||
env.add_callback("cleanString", 1, [](Arguments& args) {
|
env.add_callback("cleanString", 1, [](Arguments& args) {
|
||||||
string badChars = ".'{} \n\t-_\u00e9";
|
string badChars = ".'{} \n\t-\u00e9";
|
||||||
string str = args.at(0)->get<string>();
|
string str = args.at(0)->get<string>();
|
||||||
str.erase(remove_if(str.begin(), str.end(), [&badChars](const char &c) {
|
for (uint i = 0; i < str.length(); i++) {
|
||||||
return badChars.find(c) != std::string::npos;
|
if (badChars.find(str[i]) != std::string::npos) {
|
||||||
}), str.end());
|
str[i] = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user