|
template<typename I = unsigned>
requires std::is_integral_v<I> |
| static std::optional< I > | toNum (std::string_view str, int base=10) noexcept |
| | Convert str to a number.
|
| static constexpr std::string_view::size_type | iFind (std::string_view str, std::string_view sub) noexcept |
| | Like string::find() but ignoring case.
|
| static std::vector< std::string > | split (std::string str, const std::string &delim, const std::optional< char > &comment=std::nullopt) noexcept |
| | Split a string into vector of strings, DO NOT USE THIS.
|
| static std::vector< std::string_view > | splitSV (std::string_view str, std::string_view delim, std::optional< char > comment=std::nullopt) noexcept |
| | Split str by delim into a vector, ignoring everything after comment.
|
| template<typename T> |
| static constexpr T | trim (const T &line) noexcept |
| | Trim string (remove surrounding whitespace)
|
| static constexpr bool | isHex (std::string_view s) noexcept |
| | Is the string consisting of hex number?
|
template<std::ranges::input_range Range, typename Output>
requires requires(std::ostream &out, Output output, std::ranges::range_reference_t<Range> e) { std::invoke(output, out, e); } |
| static void | join (std::ostream &out, Range &&iterable, Output output, std::string_view sep=", ") |
| | Join iterable into out using separator sep, calling output.
|
| template<std::ranges::input_range Range> |
| static void | join (std::ostream &out, Range &&iterable, std::string_view sep=", ", std::string_view quote="") |
| | Join iterable into out using separator sep and quoting quote.
|
Various helpers on strings.
template<std::ranges::input_range Range, typename Output>
requires requires(std::ostream &out, Output output, std::ranges::range_reference_t<Range> e) { std::invoke(output, out, e); }
| void SlHelpers::String::join |
( |
std::ostream & | out, |
|
|
Range && | iterable, |
|
|
Output | output, |
|
|
std::string_view | sep = ", " ) |
|
inlinestatic |
Join iterable into out using separator sep, calling output.
- Parameters
-
| out | Output stream |
| iterable | Input container |
| output | Called for every member; it should output the member to out |
| sep | Separator |