Publishing now has a space for an article and a title. Also reduced amount of copying

This commit is contained in:
Blue 2025-03-31 18:46:40 +03:00
parent 98bfab4ba5
commit 8187d045cd
Signed by: blue
GPG key ID: 9B203B252A63EE38
8 changed files with 76 additions and 35 deletions

View file

@ -28,3 +28,22 @@ Module::Module::~Module() noexcept {}
std::string Module::Module::lower(const std::string& text) {
return std::ranges::to<std::string>(text | std::views::transform(::tolower));
}
std::string_view Module::Module::pop(std::string_view& input, char delimiter) {
std::size_t pos = input.find(delimiter);
std::string_view token;
if (pos == std::string_view::npos) {
token = input;
input = {};
} else {
token = input.substr(0, pos);
pos = input.find_first_not_of(' ', pos + 1);
if (pos == std::string_view::npos)
input = {};
else
input.remove_prefix(pos);
}
return token;
}