libnick 2024.12.0
A cross-platform base for native Nickvision applications.
|
Concepts | |
concept | StringImplicitlyConstructible |
Functions | |
std::vector< std::byte > | decode (const std::string &base64) |
Converts a base64 encoded string into a list of bytes. | |
std::string | encode (const std::vector< std::byte > &bytes) |
Converts a list of bytes into a base64 encoded string. | |
bool | isValidUrl (const std::string &s) |
Gets whether or not the provided string is a valid url. | |
std::string | join (const std::vector< std::string > &values, const std::string &separator, bool separateLast=false) |
Concatenates the elements of a string list using the specified separator between each element. | |
std::string | lower (std::string s) |
Gets a fully lowercase string from the provided string. | |
std::string | newUuid () |
Generates a new uuid value. | |
std::string | newGuid () |
Generates a new guid value. | |
std::string | normalizeForFilename (const std::string &s, bool windowsOnly=false) |
Normalizes a string for use in a filename. | |
std::string | replace (std::string s, const std::string &toReplace, const std::string &replace) |
Replaces a substring within a string with a new string. | |
std::string | replace (std::string s, char toReplace, char replace) |
Replaces a character within a string with a new character. | |
template<StringImplicitlyConstructible T = std::string> | |
std::vector< T > | split (std::string s, const std::string &delimiter) |
Splits a string based on a delimiter. | |
std::vector< std::string > | splitArgs (std::string s) |
Splits a string based on argument delimiters. | |
std::string | str (const std::wstring &s) |
Converts the wstring to a string. | |
unsigned int | stoui (const std::string &s, size_t *idx=nullptr, int base=10) |
Converts a string to an unsigned int. | |
std::string | trim (const std::string &s) |
Trims whitespace form the beginning and end of a string. | |
std::string | trim (const std::string &s, char delimiter) |
Trims the delimiter character form the beginning and end of a string. | |
std::string | upper (std::string s) |
Gets a fully uppercase string from the provided string. | |
std::wstring | wstr (const std::string &s) |
Converts the string to a wstring. | |
std::vector< std::byte > Nickvision::Helpers::StringHelpers::decode | ( | const std::string & | base64 | ) |
Converts a base64 encoded string into a list of bytes.
base64 | The base64 encoded string |
std::string Nickvision::Helpers::StringHelpers::encode | ( | const std::vector< std::byte > & | bytes | ) |
Converts a list of bytes into a base64 encoded string.
bytes | The list of bytes |
bool Nickvision::Helpers::StringHelpers::isValidUrl | ( | const std::string & | s | ) |
Gets whether or not the provided string is a valid url.
s | The string to check |
std::string Nickvision::Helpers::StringHelpers::join | ( | const std::vector< std::string > & | values, |
const std::string & | separator, | ||
bool | separateLast = false ) |
Concatenates the elements of a string list using the specified separator between each element.
values | The list of strings to join |
separator | The string to use as a separator between each element |
separateLast | Whether or not to include the separator for the last joined element |
std::string Nickvision::Helpers::StringHelpers::lower | ( | std::string | s | ) |
Gets a fully lowercase string from the provided string.
s | The string to get lowercase |
std::string Nickvision::Helpers::StringHelpers::newGuid | ( | ) |
Generates a new guid value.
This function simple calls newUuid() and returns the result.
std::string Nickvision::Helpers::StringHelpers::newUuid | ( | ) |
Generates a new uuid value.
std::string Nickvision::Helpers::StringHelpers::normalizeForFilename | ( | const std::string & | s, |
bool | windowsOnly = false ) |
Normalizes a string for use in a filename.
s | The string to normalize |
windowsOnly | Whether or not to normalize strictly for Windows |
std::string Nickvision::Helpers::StringHelpers::replace | ( | std::string | s, |
char | toReplace, | ||
char | replace ) |
Replaces a character within a string with a new character.
s | The string to work on |
toReplace | The character to be replaced |
replace | The new character to replace with |
std::string Nickvision::Helpers::StringHelpers::replace | ( | std::string | s, |
const std::string & | toReplace, | ||
const std::string & | replace ) |
Replaces a substring within a string with a new string.
s | The string to work on |
toReplace | The substring to be replaced |
replace | The new string to replace with |
std::vector< T > Nickvision::Helpers::StringHelpers::split | ( | std::string | s, |
const std::string & | delimiter ) |
Splits a string based on a delimiter.
T | The type of the resulting splits (must be a type that can be implicitly converted to string) |
s | The string to split |
delimiter | The delimiter to split the string on |
std::vector< std::string > Nickvision::Helpers::StringHelpers::splitArgs | ( | std::string | s | ) |
Splits a string based on argument delimiters.
s | The string to split |
unsigned int Nickvision::Helpers::StringHelpers::stoui | ( | const std::string & | s, |
size_t * | idx = nullptr, | ||
int | base = 10 ) |
Converts a string to an unsigned int.
s | The string to convert |
idx | The address of a size_t to store the number of characters processed |
base | The number base |
std::string Nickvision::Helpers::StringHelpers::str | ( | const std::wstring & | s | ) |
Converts the wstring to a string.
s | The wstring to convert |
std::string Nickvision::Helpers::StringHelpers::trim | ( | const std::string & | s | ) |
Trims whitespace form the beginning and end of a string.
s | The string to trim (unmodified) |
std::string Nickvision::Helpers::StringHelpers::trim | ( | const std::string & | s, |
char | delimiter ) |
Trims the delimiter character form the beginning and end of a string.
s | The string to trim (unmodified) |
delimiter | The character to trim |
std::string Nickvision::Helpers::StringHelpers::upper | ( | std::string | s | ) |
Gets a fully uppercase string from the provided string.
s | The string to get uppercase |
std::wstring Nickvision::Helpers::StringHelpers::wstr | ( | const std::string & | s | ) |
Converts the string to a wstring.
s | The string to convert |