0.2.0
|
Utility functions for working with std::strings. More...
Go to the source code of this file.
Concepts | |
concept | NAV::str::StdString |
Concept limiting the type to std::string and std::wstring, but also allowing convertible types like const char*. | |
Enumerations | |
enum | NAV::str::CaseSensitivity { NAV::str::RespectCase , NAV::str::IgnoreCase } |
Enum for case sensitive tasks. More... | |
Functions | |
static void | NAV::str::ltrim (std::string &s) |
Trim from start (in place) | |
static void | NAV::str::ltrim (std::string_view &sv) |
Trim from start (in place) | |
static std::string | NAV::str::ltrim_copy (std::string s) |
Trim from start (copying) | |
static std::string_view | NAV::str::ltrim_copy (std::string_view sv) |
Trim from start (copying) | |
static bool | NAV::str::replace (std::string &str, const std::string &from, const std::string &to, CaseSensitivity cs=RespectCase) |
Replaces the first occurrence of a search pattern with another sequence. | |
static void | NAV::str::replaceAll (std::string &str, const std::string &from, const std::string &to, CaseSensitivity cs=RespectCase) |
Replaces all occurrence of a search pattern with another sequence. | |
static std::string | NAV::str::replaceAll_copy (std::string str, const std::string &from, const std::string &to, CaseSensitivity cs=RespectCase) |
Replaces all occurrence of a search pattern with another sequence. | |
static void | NAV::str::rtrim (std::string &s) |
Trim from end (in place) | |
static void | NAV::str::rtrim (std::string_view &sv) |
Trim from end (in place) | |
static std::string | NAV::str::rtrim_copy (std::string s) |
Trim from end (copying) | |
static std::string_view | NAV::str::rtrim_copy (std::string_view sv) |
Trim from end (copying) | |
static std::vector< std::string > | NAV::str::split (const std::string &str, char delimiter) |
Splits a string into parts at a delimiter. | |
static std::vector< std::string > | NAV::str::split (const std::string &str, const std::string &delimiter) |
Splits a string into parts at a delimiter. | |
static std::vector< std::string > | NAV::str::split_wo_empty (const std::string &str, char delimiter) |
Splits a string into parts at a delimiter and removes empty entries. | |
static std::vector< std::string > | NAV::str::split_wo_empty (const std::string &str, const std::string &delimiter) |
Splits a string into parts at a delimiter and removes empty entries. | |
template<StdString String> | |
double | NAV::str::stod (const String &str, double default_value, std::size_t *pos=nullptr) noexcept |
Interprets a value in the string str. | |
template<StdString String> | |
float | NAV::str::stof (const String &str, float default_value, std::size_t *pos=nullptr) noexcept |
Interprets a value in the string str. | |
template<StdString String> | |
int | NAV::str::stoi (const String &str, int default_value, std::size_t *pos=nullptr, int base=10) noexcept |
Interprets a value in the string str. | |
template<StdString String> | |
int64_t | NAV::str::stol (const String &str, int64_t default_value, std::size_t *pos=nullptr, int base=10) noexcept |
Interprets a value in the string str. | |
template<StdString String> | |
long double | NAV::str::stold (const String &str, long double default_value, std::size_t *pos=nullptr) noexcept |
Interprets a value in the string str. | |
template<StdString String> | |
int64_t | NAV::str::stoll (const String &str, int64_t default_value, std::size_t *pos=nullptr, int base=10) noexcept |
Interprets a value in the string str. | |
static void | NAV::str::trim (std::string &s) |
Trim from both ends (in place) | |
static void | NAV::str::trim (std::string_view &sv) |
Trim from both ends (in place) | |
static std::string | NAV::str::trim_copy (std::string s) |
Trim from both ends (copying) | |
static std::string_view | NAV::str::trim_copy (std::string_view sv) |
Trim from both ends (copying) | |
Utility functions for working with std::strings.
|
inlinestatic |
Trim from start (in place)
[in,out] | s | The string to trim |
|
inlinestatic |
Trim from start (in place)
[in,out] | sv | The string view to trim |
|
inlinestatic |
Trim from start (copying)
[in] | s | The string to trim |
|
inlinestatic |
Trim from start (copying)
[in] | sv | The string view to trim |
|
inlinestatic |
Replaces the first occurrence of a search pattern with another sequence.
[in,out] | str | String to search in and return value |
[in] | from | String pattern to search for |
[in] | to | Replacement string |
[in] | cs | Case sensitivity |
|
inlinestatic |
Replaces all occurrence of a search pattern with another sequence.
[in,out] | str | String to search in and return value |
[in] | from | String pattern to search for |
[in] | to | Replacement string |
[in] | cs | Case sensitivity |
|
inlinestatic |
Replaces all occurrence of a search pattern with another sequence.
[in,out] | str | String to search in and return value |
[in] | from | String pattern to search for |
[in] | to | Replacement string |
[in] | cs | Case sensitivity |
|
inlinestatic |
Trim from end (in place)
[in,out] | s | The string to trim |
|
inlinestatic |
Trim from end (in place)
[in,out] | sv | The string view to trim |
|
inlinestatic |
Trim from end (copying)
[in] | s | The string to trim |
|
inlinestatic |
Trim from end (copying)
[in] | sv | The string view to trim |
|
inlinestatic |
Splits a string into parts at a delimiter.
[in] | str | String to split |
[in] | delimiter | Character to split at |
|
inlinestatic |
Splits a string into parts at a delimiter.
[in] | str | String to split |
[in] | delimiter | Sequence of characters to split at |
|
inlinestatic |
Splits a string into parts at a delimiter and removes empty entries.
[in] | str | String to split |
[in] | delimiter | Character to split at |
|
inlinestatic |
Splits a string into parts at a delimiter and removes empty entries.
[in] | str | String to split |
[in] | delimiter | Sequence of characters to split at |
|
noexcept |
Interprets a value in the string str.
String | std::string or std::wstring and also allowing convertible types like const char* |
str | the string to convert |
default_value | default value to take if an invalid argument is given |
pos | address of an integer to store the number of characters processed |
|
noexcept |
Interprets a value in the string str.
String | std::string or std::wstring and also allowing convertible types like const char* |
str | the string to convert |
default_value | default value to take if an invalid argument is given |
pos | address of an integer to store the number of characters processed |
|
noexcept |
Interprets a value in the string str.
String | std::string or std::wstring and also allowing convertible types like const char* |
str | the string to convert |
default_value | default value to take if an invalid argument is given |
pos | address of an integer to store the number of characters processed |
base | the number base |
|
noexcept |
Interprets a value in the string str.
String | std::string or std::wstring and also allowing convertible types like const char* |
str | the string to convert |
default_value | default value to take if an invalid argument is given |
pos | address of an integer to store the number of characters processed |
base | the number base |
|
noexcept |
Interprets a value in the string str.
String | std::string or std::wstring and also allowing convertible types like const char* |
str | the string to convert |
default_value | default value to take if an invalid argument is given |
pos | address of an integer to store the number of characters processed |
|
noexcept |
Interprets a value in the string str.
String | std::string or std::wstring and also allowing convertible types like const char* |
str | the string to convert |
default_value | default value to take if an invalid argument is given |
pos | address of an integer to store the number of characters processed |
base | the number base |
|
inlinestatic |
Trim from both ends (in place)
[in,out] | s | The string to trim |
|
inlinestatic |
Trim from both ends (in place)
[in,out] | sv | The string view to trim |
|
inlinestatic |
Trim from both ends (copying)
[in] | s | The string to trim |
|
inlinestatic |
Trim from both ends (copying)
[in] | sv | The string view to trim |