String manipulations
Operations for strings.
Name | Description |
---|---|
join | Join generated string-like objects into a string, with each element separated by joiner . The joiner defaults to the empty string. |
split(std::string_view split_string) | Split input based on a split_string , generating a std::string_view for each substring. Note a std::regex variant is available. |
join
<piped/string.hpp>
constexpr detail::join_ piped::join
Description
Join generated string-like objects into a string, with each element separated by joiner
. The joiner
defaults to the empty string.
Optionally: join(std::string_view joiner)
Example:
auto s = "a,b,c" | split(",") | join(":");
s == "a:b:c"; // => true
split(std::string_view split_string)
<piped/string.hpp>
auto piped::split(std::string_view split_string)
Description
Split input based on a split_string
, generating a std::string_view
for each substring. Note a std::regex variant is available.
Example:
auto v = "a,b,c" | split(",") | collect<std::vector>;
// Produces ["a","b","c"]
// v is a std::vector<std::string_view>
Parameter | ||
---|---|---|
split_string | std::string_view |
← Regex Type Utility →