Publishing now has a space for an article and a title. Also reduced amount of copying
This commit is contained in:
parent
98bfab4ba5
commit
8187d045cd
8 changed files with 76 additions and 35 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue