mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 12:37:45 +01:00
format
This commit is contained in:
parent
cbbceb4d0d
commit
6298361cc9
@ -279,9 +279,12 @@ std::string str_snake_case(const std::string &str) {
|
|||||||
}
|
}
|
||||||
std::string str_sanitize(const std::string &str) {
|
std::string str_sanitize(const std::string &str) {
|
||||||
std::string out;
|
std::string out;
|
||||||
std::replace_if(str.begin(), str.end(), [](const char &c) {
|
std::replace_if(
|
||||||
return c == '-' || c == '_' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
str.begin(), str.end(),
|
||||||
}, '_');
|
[](const char &c) {
|
||||||
|
return c == '-' || c == '_' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||||
|
},
|
||||||
|
'_');
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
std::string str_snprintf(const char *fmt, size_t len, ...) {
|
std::string str_snprintf(const char *fmt, size_t len, ...) {
|
||||||
|
Loading…
Reference in New Issue
Block a user