1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-14 06:38:17 +00:00

fix: improve token handling in split_to_int_vector_ for better readability and maintainability

This commit is contained in:
Oliver Kleinecke 2025-02-19 11:19:08 +01:00
parent f51f5cd70b
commit e598375c3f

View File

@ -342,8 +342,8 @@ std::vector<uint8_t> DynamicLampComponent::split_to_int_vector_(const std::strin
size_t pos = 0;
uint8_t token;
while ((pos = s.find(delimiter)) != std::string::npos) {
c_substr = s.substr(0, pos).c_str();
token = static_cast<uint8_t>(atoi(c_substr));
std::string substr = s.substr(0, pos);
token = static_cast<uint8_t>(atoi(substr.c_str()));
tokens.push_back(token);
s.erase(0, pos + delimiter.length());
}