// This source code is released into the public domain. export module nihil.util:skipws; import :ctype; namespace nihil { // Remove leading whitespace from a string. export template [[nodiscard]] auto skipws(std::basic_string_view text, std::locale const &locale = std::locale()) -> std::basic_string_view { auto is_space = ctype_is(std::ctype_base::space, locale); auto nonws = std::ranges::find_if_not(text, is_space); return {nonws, std::ranges::end(text)}; } export template auto skipws(std::basic_string_view *text, std::locale const &locale = std::locale()) -> void { *text = skipws(*text, locale); } } // namespace nihil