mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil] Add remove_prefix() and remove_suffix() (#6118)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user