From 6df229036c6edfff7d8692bc81492785a2191d2f Mon Sep 17 00:00:00 2001 From: "S. Kozyr" Date: Thu, 28 Oct 2021 13:27:20 +0300 Subject: [PATCH] PR review fixes. Improved `stripAtSymbol` function Signed-off-by: S. Kozyr --- generator/osm2meta.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/generator/osm2meta.cpp b/generator/osm2meta.cpp index e56a28cdfd..22272b3425 100644 --- a/generator/osm2meta.cpp +++ b/generator/osm2meta.cpp @@ -293,25 +293,15 @@ string MetadataTagProcessorImpl::ValidateAndFormat_vk(string const & vkPage) con return {}; } -string const stripAtSymbol(string const & lineId) +// Strip '%40' and `@` chars from Line ID start. +string stripAtSymbol(string const & lineId) { if (lineId.empty()) return lineId; - if (strings::StartsWith(lineId, "%40")) // Strip '%40' chars from Line ID. - return lineId.substr(3); - if (lineId.front() == '@') // Strip '@' char from Line ID. + if (lineId.front() == '@') return lineId.substr(1); - return lineId; -} - -string & stripAtSymbol(string & lineId) -{ - if (lineId.empty()) - return lineId; - if (strings::StartsWith(lineId, "%40")) // Strip '%40' chars from Line ID. - lineId = lineId.substr(3); - if (lineId.front() == '@') // Strip '@' char from Line ID. - lineId = lineId.erase(0, 1); + if (strings::StartsWith(lineId, "%40")) + return lineId.substr(3); return lineId; }