3#include <StormByte/exception.hxx>
4#include <StormByte/expected.hxx>
5#include <StormByte/visibility.h>
25namespace StormByte::String {
32 enum class STORMBYTE_PUBLIC Format :
unsigned short {
47 constexpr STORMBYTE_PUBLIC std::string Indent(
const int& level)
noexcept {
48 return level == 0 ? std::string() : std::string(level,
'\t');
59 constexpr STORMBYTE_PUBLIC
bool IsNumeric(
const std::string& str)
noexcept {
60 return !str.empty() && std::all_of(str.begin(), str.end(), ::isdigit);
71 STORMBYTE_PUBLIC std::string ToLower(
const std::string& str)
noexcept;
81 STORMBYTE_PUBLIC std::string ToUpper(
const std::string& str)
noexcept;
93 STORMBYTE_PUBLIC std::queue<std::string> Explode(
const std::string& str,
const char delimiter);
104 STORMBYTE_PUBLIC std::vector<std::string> Split(
const std::string& str);
143 template <
typename T,
typename = std::enable_if_t<std::is_arithmetic_v<T> && !std::is_same_v<T,
wchar_t>>>
144 STORMBYTE_PUBLIC std::string HumanReadable(
const T& number,
const Format& format,
const std::string& locale =
"en_US.UTF-8") noexcept;
155 STORMBYTE_PUBLIC std::
string UTF8Encode(const std::wstring& ws);
166 STORMBYTE_PUBLIC std::wstring UTF8Decode(const std::
string& s);
176 STORMBYTE_PUBLIC std::
string SanitizeNewlines(const std::
string& str) noexcept;
186 STORMBYTE_PUBLIC std::
string FromByteVector(const std::vector<std::
byte>& byte_vector) noexcept;
196 STORMBYTE_PUBLIC std::vector<std::
byte> ToByteVector(const std::
string& str) noexcept;
206 STORMBYTE_PUBLIC std::
string RemoveWhitespace(const std::
string& str) noexcept;
std::conditional_t< Type::Reference< T >, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, std::shared_ptr< E > >, std::expected< T, std::shared_ptr< E > > > Expected
Expected type with support for reference types.
Definition expected.hxx:33