1
0
mirror of https://github.com/esphome/esphome.git synced 2024-10-05 18:30:57 +01:00
This commit is contained in:
J. Nick Koston 2023-11-21 00:25:17 +01:00
parent 54f28f7719
commit 70a89efb36
No known key found for this signature in database

View File

@ -278,9 +278,9 @@ std::string str_snake_case(const std::string &str) {
return result;
}
std::string str_sanitize(const std::string &str) {
std::string out;
std::string out = str;
std::replace_if(
str.begin(), str.end(),
out.begin(), out.end(),
[](const char &c) {
return !(c == '-' || c == '_' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
},