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);
135 string_view first, string_view second) ->
size_t;
156template <std::integral Int>
158 const string_view text, Int defaultValue) noexcept
162 std::next(text.data(),
static_cast<ptrdiff_t
>(text.length())),
168template <
size_t MaxLen>
170 const std::integral
auto value,
173 std::array<char, MaxLen + 1uz> buffer { };
175 const auto result = std::to_chars(
177 std::next(buffer.data(),
static_cast<ptrdiff_t
>(buffer.size())),
181 if (result.ec != std::errc { })
186 static_cast<size_t>(std::distance(buffer.data(), result.ptr)));
192 | std::views::split(delim)
193 | 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 levenshtein_distance(string_view first, string_view second) -> size_t
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 >