Initial site generation
This commit is contained in:
parent
f44c79dc1f
commit
fc44290e3f
35 changed files with 667 additions and 303 deletions
|
@ -53,13 +53,11 @@ std::string StringUtils::strip(const std::string& input)
|
|||
return {};
|
||||
}
|
||||
|
||||
std::locale loc;
|
||||
std::string working_string;
|
||||
std::size_t first_nonspace = 0;
|
||||
std::size_t last_nonspace = working_string.size() - 1;
|
||||
for (std::size_t idx = 0; idx < working_string.size(); idx++)
|
||||
std::size_t last_nonspace = input.size() - 1;
|
||||
for (std::size_t idx = 0; idx < input.size(); idx++)
|
||||
{
|
||||
if (!std::isspace(working_string[idx], loc))
|
||||
if (!std::isspace(input[idx]))
|
||||
{
|
||||
first_nonspace = idx;
|
||||
break;
|
||||
|
@ -73,13 +71,13 @@ std::string StringUtils::strip(const std::string& input)
|
|||
|
||||
for (std::size_t idx = last_nonspace; idx > 0; idx--)
|
||||
{
|
||||
if (!std::isspace(working_string[idx], loc))
|
||||
if (!std::isspace(input[idx]))
|
||||
{
|
||||
last_nonspace = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return working_string.substr(first_nonspace, last_nonspace-first_nonspace);
|
||||
return input.substr(first_nonspace, last_nonspace-first_nonspace + 1);
|
||||
}
|
||||
|
||||
std::vector<std::string> StringUtils::split(const std::string& input)
|
||||
|
@ -166,3 +164,21 @@ std::string StringUtils::stripQuotes(const std::string& input)
|
|||
}
|
||||
return input.substr(start_index, end_index - start_index + 1);
|
||||
}
|
||||
|
||||
std::string StringUtils::replaceWith(const std::string& inputString, const std::string& searchString, const std::string& replaceString)
|
||||
{
|
||||
return inputString;
|
||||
}
|
||||
|
||||
std::string StringUtils::removeUpTo(const std::string& input, const std::string& prefix)
|
||||
{
|
||||
std::size_t found = input.find(prefix);
|
||||
if (found!=std::string::npos)
|
||||
{
|
||||
return input.substr(found, prefix.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue