[wpiutil] Add remove_prefix() and remove_suffix() (#6118)

This commit is contained in:
Joseph Eng
2024-06-04 21:01:52 -07:00
committed by GitHub
parent 8def7b2222
commit d6b66bfa55
12 changed files with 131 additions and 68 deletions

View File

@@ -256,7 +256,7 @@ NTMechanism2DModel::~NTMechanism2DModel() = default;
void NTMechanism2DModel::Update() {
for (auto&& event : m_poller.ReadQueue()) {
if (auto info = event.GetTopicInfo()) {
auto name = wpi::drop_front(info->name, m_path.size());
auto name = wpi::remove_prefix(info->name, m_path).value_or("");
if (name.empty() || name[0] == '.') {
continue;
}
@@ -307,7 +307,7 @@ void NTMechanism2DModel::Update() {
}
} else {
auto fullName = nt::Topic{valueData->topic}.GetName();
auto name = wpi::drop_front(fullName, m_path.size());
auto name = wpi::remove_prefix(fullName, m_path).value_or("");
if (name.empty() || name[0] == '.') {
continue;
}