37#include <system_error>
47using std::string_view;
60[[nodiscard]]
auto trim(string_view text) -> string_view;
87 -> std::expected<size_t, std::string>;
93template <std::
integral Int>
95 string_view text, Int defaultValue = 0) noexcept
107template <
size_t MaxLen = 5uz>
109 std::integral auto value,
110 std::
string& output);
124[[nodiscard]] auto
lines_view(string_view text);
131[[nodiscard]] auto
words_view(string_view text);
152template <std::integral Int>
154 const string_view text, Int defaultValue) noexcept
158 std::next(text.data(),
static_cast<ptrdiff_t
>(text.length())),
164template <
size_t MaxLen>
166 const std::integral
auto value,
169 std::array<char, MaxLen + 1uz> buffer { };
171 const auto result = std::to_chars(
173 std::next(buffer.data(),
static_cast<ptrdiff_t
>(buffer.size())),
177 if (result.ec != std::errc { })
182 static_cast<size_t>(std::distance(buffer.data(), result.ptr)));
188 | std::views::split(delim)
189 | std::views::transform([](
const auto rng) {
return string_view { rng }; });
std::pair< string_view, string_view > StringViewPair
auto words_view(string_view text)
auto trim(string_view text) -> string_view
auto split_at_first_space(string_view input) -> StringViewPair
constexpr auto int_from_string(string_view text, Int defaultValue=0) noexcept -> Int
auto lines_view(string_view text)
auto split_by_delim(string_view text, char delim)
void write_integer(std::integral auto value, std::string &output)
auto split_at_first_space_or_newline(string_view input) -> StringViewPair
auto find_matching_close_paren(string_view input) -> std::expected< size_t, std::string >