mirror of
https://github.com/esphome/esphome.git
synced 2025-09-07 22:02:22 +01:00
use boost::algorithm::trim to clean output list strings in set_available_outputs()
This commit is contained in:
@@ -91,8 +91,8 @@ void DynamicLamp::set_available_outputs(std::string output_list) {
|
|||||||
for ( std::string s : v )
|
for ( std::string s : v )
|
||||||
{
|
{
|
||||||
std::string id_string;
|
std::string id_string;
|
||||||
id_string = std::regex_replace(s, std::regex("^ +| +$|( ) +"), "$1");
|
id_string = boost::algorithm::trim(s.c_str());
|
||||||
this->available_outputs_[counter] = s.c_str();
|
this->available_outputs_[counter] = id_string;
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace dynamic_lamp {
|
namespace dynamic_lamp {
|
||||||
|
Reference in New Issue
Block a user