47 std::vector<std::string>
split(std::string
const & str, std::string_view sep =
" ",
bool skipEmpty =
true,
bool shouldTrim =
false);
61 std::vector<std::string_view>
splitView(std::string_view str, std::string_view sep =
" ",
bool skipEmpty =
true,
bool shouldTrim =
false);
67 std::string
toLower(std::string_view str);
73 std::string
toUpper(std::string_view str);
81 std::string &
ltrim(std::string & s)
noexcept;
88 std::string &
rtrim(std::string & s)
noexcept;
95 std::string &
trim(std::string & s)
noexcept;
103 std::string_view &
trimView(std::string_view & str)
noexcept;
115 template<
typename T1,
typename T2>
116 bool isOneOf(T1 val, std::initializer_list<T2 const> list)
117 {
return std::find(std::begin(list), std::end(list), val) != std::end(list); }
129 template<
typename T1,
typename T2>
130 bool isOneOf(T1 val, std::span<T2 const> list)
131 {
return std::find(std::begin(list), std::end(list), val) != std::end(list); }
139 std::string
formatBytes(std::uint64_t byteCount, std::size_t precision = 2);
Definition SystemConfigCommandHandler.hpp:15
std::string_view boolToString(bool value) noexcept
Convert a boolean value to a stable textual representation.
std::string & trim(std::string &s) noexcept
Trim leading and trailing whitespace from a string in-place.
std::string formatBytes(std::uint64_t byteCount, std::size_t precision=2)
Format a byte count as a human-readable string.
std::string_view & trimView(std::string_view &str) noexcept
Trim leading and trailing whitespace from a string view by adjusting its boundaries.
std::vector< std::string_view > splitView(std::string_view str, std::string_view sep=" ", bool skipEmpty=true, bool shouldTrim=false)
Split a string view into substring views separated by sep.
std::string toLower(std::string_view str)
Convert a string to lower case.
std::string & ltrim(std::string &s) noexcept
Trim leading whitespace from a string in-place.
std::string & rtrim(std::string &s) noexcept
Trim trailing whitespace from a string in-place.
std::optional< bool > boolFromString(std::string_view str) noexcept
Parse a boolean value from text.
std::string_view strsignal(int sig) noexcept
Convert a signal number to a stringified version.
std::string toUpper(std::string_view str)
Convert a string to upper case.
std::vector< std::string > split(std::string const &str, std::string_view sep=" ", bool skipEmpty=true, bool shouldTrim=false)
Split a string into substrings separated by sep.
bool isOneOf(T1 val, std::initializer_list< T2 const > list)
Test whether val is equal to one of the elements in list.
Definition Utility.hpp:116