Extend Split to work with multiple separators

This commit is contained in:
Martin Leitner-Ankerl
2022-05-02 21:44:09 +02:00
parent 12455acca2
commit b7ab9db545
3 changed files with 45 additions and 12 deletions

View File

@@ -14,6 +14,7 @@
#include <locale>
#include <sstream>
#include <string>
#include <string_view>
#include <vector>
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, char sep)
@@ -21,6 +22,11 @@
return spanparsing::Split<std::string>(str, sep);
}
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, std::string_view separators)
{
return spanparsing::Split<std::string>(str, separators);
}
[[nodiscard]] inline std::string_view TrimStringView(std::string_view str, std::string_view pattern = " \f\n\r\t\v")
{
std::string::size_type front = str.find_first_not_of(pattern);