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:
parent
f51f5cd70b
commit
e598375c3f
@ -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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user