15 inline constexpr std::string_view
Whitespace =
" \t\n\r\f\v";
27 str.remove_suffix(
last == std::string_view::npos ?
str.size() :
str.size() -
last - 1);
String helpers: case, trimming, splitting, joining, replacing, parsing and hashing.
Definition Char.hpp:3
std::string rtrimCopy(std::string_view str, std::string_view chars=Whitespace)
std::string ltrimCopy(std::string_view str, std::string_view chars=Whitespace)
constexpr std::string_view trimView(std::string_view str, std::string_view chars=Whitespace) noexcept
Definition Trim.hpp:31
constexpr std::string_view rtrimView(std::string_view str, std::string_view chars=Whitespace) noexcept
Definition Trim.hpp:24
constexpr std::string_view ltrimView(std::string_view str, std::string_view chars=Whitespace) noexcept
Definition Trim.hpp:17
void trim(std::string &str, std::string_view chars=Whitespace)
void rtrim(std::string &str, std::string_view chars=Whitespace)
constexpr std::string_view Whitespace
Characters trimmed by default: space, tab, line feed, carriage return, form feed and vertical tab.
Definition Trim.hpp:15
std::string trimCopy(std::string_view str, std::string_view chars=Whitespace)
void ltrim(std::string &str, std::string_view chars=Whitespace)
std::optional< T > parseNumber(std::string_view text, int base=10) noexcept
Parses text as a number, or returns std::nullopt if it is not entirely one.
Definition Convert.hpp:23