66 return level == 0 ? std::string() : std::string(level,
'\t');
75 return !str.empty() && std::all_of(str.begin(), str.end(), [](
unsigned char c) {
76 return std::isdigit(c) != 0;
114 template <
typename T,
typename = std::enable_if_t<std::is_arithmetic_v<T> && !std::is_same_v<T,
wchar_t>>>
String helpers (case, split, UTF-8, human-readable numbers).
std::wstring UTF8Decode(std::string_view s)
UTF-8 text to wide string.
std::vector< std::byte > ToByteVector(std::string_view str) noexcept
Copies text bytes into a vector<std::byte>.
std::string HumanReadable(const T &number, const Format &format, const std::string &locale="en_US.UTF-8") noexcept
Formats an arithmetic value (not wchar_t).
std::queue< std::string > Explode(std::string_view str, const char delimiter)
Splits on delimiter into a queue (empty tokens kept).
std::string ToUpper(std::string_view str) noexcept
Uppercase copy of str.
bool IsInteger(std::string_view str) noexcept
true when str parses as an integer (optional leading +/-).
Format
How HumanReadable prints a number.
Definition string.hxx:55
@ HumanReadableNumber
Grouped / locale number.
@ HumanReadableBytes
Byte units (KiB, MiB, …).
std::string ToLower(std::string_view str) noexcept
Lowercase copy of str.
std::string SanitizeNewlines(std::string_view str) noexcept
Normalizes \r\n to \n.
std::string UTF8Encode(std::wstring_view ws)
Wide text to UTF-8.
constexpr std::string Indent(const int &level) noexcept
level tab characters, or empty when level == 0.
Definition string.hxx:65
std::string RemoveWhitespace(std::string_view str) noexcept
Strips every whitespace character.
std::vector< std::string > Split(std::string_view str)
Splits on ASCII whitespace into a vector.
constexpr bool IsNumeric(std::string_view str) noexcept
true when every character is a decimal digit (std::isdigit).
Definition string.hxx:74
std::string FromByteVector(const std::vector< std::byte > &byte_vector) noexcept
Interprets bytes as char and builds a string.
#define STORMBYTE_PUBLIC
Definition visibility.h:28