|
GlitchyByte Lib
0.3.1
GlitchyByte general library to bootstrap development.
|
Classes | |
| class | StringNumberParseException |
Functions | |
| constexpr std::vector< std::string_view > | createVectorStringViewFromCArray (int const argc, char const *argv[]) noexcept |
| constexpr std::vector< std::string > | createVectorStringFromCArray (int const argc, char const *argv[]) noexcept |
| constexpr std::string | replace (std::string_view const str, std::string_view const token, std::string_view const value) noexcept |
| constexpr std::string & | replaceInPlace (std::string &str, std::string_view const token, std::string_view const value) noexcept |
| constexpr std::vector< std::string_view > | splitWeak (std::string_view const str, std::string_view const delimiter) noexcept |
| constexpr std::vector< std::string > | split (std::string_view const &str, std::string_view const &delimiter) noexcept |
| std::string | unindent (std::string_view const str) noexcept |
| template<typename T > | |
| std::string | fromVector (std::vector< T > const &vector, std::string_view const separator=", ") noexcept |
| constexpr std::string | addThousandSeparators (std::string_view const str) noexcept |
| std::string | fromTime (std::time_t const &time, std::string const &format) noexcept |
| template<Numeric T> | |
| constexpr std::string | fromNumber (T const value) noexcept |
| template<std::integral T> | |
| T | toNumber (std::string_view const str) |
| template<std::integral T> | |
| constexpr std::string | hexFromNumber (T const value, bool const padding=false, bool const uppercase=false) noexcept |
| template<std::integral T> | |
| T | hexToNumber (std::string_view const str) |
Variables | |
| constexpr std::errc | errcSuccess {} |
|
inlineconstexprnoexcept |
Converts a C string array into a vector of string_views.
The contents of the vector will be valid as long as the original array is valid.
This function is specifically designed to convert main function args into a string vector.
| argc | String array size. |
| argv | Array of C strings. |
|
inlineconstexprnoexcept |
Converts a C string array into a vector of strings.
This function is specifically designed to convert main function args into a string vector.
| argc | String array size. |
| argv | Array of C strings. |
|
inlineconstexprnoexcept |
Convenience replace of a token in a string.
This creates a new string, so it is only a shortcut, not efficient for replacing many tokens.
| str | String to search for token. |
| token | Token to find. |
| value | Value to replace the token with. |
|
inlineconstexprnoexcept |
Convenience replace of a token in a string.
This modifies the string,
| str | String to search for token. |
| token | Token to find. |
| value | Value to replace the token with. |
|
inlineconstexprnoexcept |
Splits a string by the delimiter into a vector of strings.
Storage is weak. Meaning, the resulting vector is actually pointing at sections in the original string. This is faster than regular split, but if the original string goes away, the contents of this vector are not valid.
| str | String to split. |
| delimiter | Delimiter to split the string. |
|
inlineconstexprnoexcept |
Splits a string by the delimiter into a vector of strings.
| str | String to split. |
| delimiter | Delimiter to split the string. |
|
inlinenoexcept |
Unindents a multiline block of text by removing all common spaces or tabs from the beginning of the lines. Empty lines are left alone.
This function is specifically designed to use with raw string literals. And it will remove indentation created to align the string with the rest of the surrounding code.
Only spaces are considered when recognizing indentation.
| str | String to unindent. |
|
inlinenoexcept |
Joins a string representation of all elements into a string. By default each item is separated by a comma and a space.
| T | The type of item. |
| vector | Vector of items to join. |
| separator | Separator between items. |
|
inlineconstexprnoexcept |
Adds thousand separators in the given string that must be a numeric representation.
| str | String numeric representation. |
|
inlinenoexcept |
Returns a string representation of the given time.
| time | Time to convert to string. |
| format | Time format. |
|
constexprnoexcept |
Converts a number value to a string representation.
| T | A numeric type. |
| value | Number value. |
|
inline |
Converts a string to its number value representation.
| T | A numeric type. |
| str | A string. |
| StringNumberParseException | if the string can't be parsed to a numeric value. |
|
constexprnoexcept |
Converts a number value to a string hex representation.
| T | An integral type. |
| value | Number value. |
| padding | If true, the representation will be padded with 0s to the extent of the type. Default is false. |
| uppercase | If true, letters will be in uppercase. Default is false. |
|
inline |
Converts a hex string to its number value representation.
| T | An integral type. |
| str | A hex string. |
| StringNumberParseException | if the hex string can't be parsed to an integral value. |
|
constexpr |
errc success constant.