|
::std::string | cras::appendIfNonEmpty (const ::std::string &str, const ::std::string &suffix) |
| If str is nonempty, returns str + suffix, otherwise empty string. More...
|
|
bool | cras::contains (const ::std::string &str, char c) |
| Check whether str contains character c . More...
|
|
bool | cras::contains (const ::std::string &str, const ::std::string &needle) |
| Check whether str contains substring needle . More...
|
|
bool | cras::endsWith (const ::std::string &str, const ::std::string &suffix) |
| Check whether suffix is a suffix of str . More...
|
|
inline ::std::string | cras::format (const char *format, ::va_list args) |
|
inline ::std::string | cras::format (const char *format,...) |
|
inline ::std::string | cras::format (::std::string format,...) |
|
inline ::std::string | cras::format (::std::string format, ::va_list args) |
|
template<typename T > |
::std::string | cras::join (const T &strings, const ::std::string &delimiter) |
| Return a string that is a concatenation of elements of strings delimited by delimiter . More...
|
|
double | cras::parseDouble (const ::std::string &string) |
| Parse the given string to a double. More...
|
|
double | cras::parseDouble (const char *string) |
| Parse the given string to a double. More...
|
|
float | cras::parseFloat (const ::std::string &string) |
| Parse the given string to a float. More...
|
|
float | cras::parseFloat (const char *string) |
| Parse the given string to a float. More...
|
|
int16_t | cras::parseInt16 (const std::string &string) |
| Parse the given string to a 16-bit int. More...
|
|
int16_t | cras::parseInt16 (const char *string) |
| Parse the given string to a 16-bit int. More...
|
|
int32_t | cras::parseInt32 (const std::string &string) |
| Parse the given string to a 32-bit int. More...
|
|
int32_t | cras::parseInt32 (const char *string) |
| Parse the given string to a 32-bit int. More...
|
|
int64_t | cras::parseInt64 (const std::string &string) |
| Parse the given string to a 64-bit int. More...
|
|
int64_t | cras::parseInt64 (const char *string) |
| Parse the given string to a 64-bit int. More...
|
|
int8_t | cras::parseInt8 (const std::string &string) |
| Parse the given string to a 8-bit int. More...
|
|
int8_t | cras::parseInt8 (const char *string) |
| Parse the given string to a 8-bit int. More...
|
|
uint16_t | cras::parseUInt16 (const std::string &string) |
| Parse the given string to a 16-bit unsigned int. More...
|
|
uint16_t | cras::parseUInt16 (const char *string) |
| Parse the given string to a 16-bit unsigned int. More...
|
|
uint32_t | cras::parseUInt32 (const std::string &string) |
| Parse the given string to a 32-bit unsigned int. More...
|
|
uint32_t | cras::parseUInt32 (const char *string) |
| Parse the given string to a 32-bit unsigned int. More...
|
|
uint64_t | cras::parseUInt64 (const std::string &string) |
| Parse the given string to a 64-bit unsigned int. More...
|
|
uint64_t | cras::parseUInt64 (const char *string) |
| Parse the given string to a 64-bit unsigned int. More...
|
|
uint8_t | cras::parseUInt8 (const std::string &string) |
| Parse the given string to a 8-bit unsigned int. More...
|
|
uint8_t | cras::parseUInt8 (const char *string) |
| Parse the given string to a 8-bit unsigned int. More...
|
|
::std::string | cras::prependIfNonEmpty (const ::std::string &str, const ::std::string &prefix) |
| If str is nonempty, returns prefix + str, otherwise empty string. More...
|
|
template<typename T , ::std::enable_if_t<!::cras::is_string<::std::decay_t< T >>::value, bool > = true> |
inline ::std::string | cras::quoteIfStringType (const ::std::string &s, const T &) |
| Put s in double quotes if T is a string type (std::string or char*). More...
|
|
::std::string | cras::removePrefix (const ::std::string &str, const ::std::string &prefix, bool *hadPrefix=nullptr) |
| Remove prefix from start of str if it contains it, otherwise return str unchanged. More...
|
|
::std::string | cras::removeSuffix (const ::std::string &str, const ::std::string &suffix, bool *hadSuffix=nullptr) |
| Remove suffix from end of str if it contains it, otherwise return str unchanged. More...
|
|
::std::string | cras::replace (const ::std::string &str, const ::std::string &from, const ::std::string &to, const ::cras::ReplacePosition &where=::cras::ReplacePosition::EVERYWHERE) |
| Replace all occurrences of from in str with to . More...
|
|
void | cras::replace (::std::string &str, const ::std::string &from, const ::std::string &to, const ::cras::ReplacePosition &where=::cras::ReplacePosition::EVERYWHERE) |
| Replace all occurrences of from in str with to . More...
|
|
::std::vector<::std::string > | cras::split (const ::std::string &str, const ::std::string &delimiter, int maxSplits=-1) |
| Split the given string by the given delimiter. More...
|
|
bool | cras::startsWith (const ::std::string &str, const ::std::string &prefix) |
| Check whether prefix is a prefix of str . More...
|
|
void | cras::strip (::std::string &s, const char &c=' ') |
| Strip c from the beginning and end of the given string (if it is there). More...
|
|
::std::string | cras::strip (const ::std::string &s, const char &c=' ') |
| Return a copy of the given string with c removed from its beginning and end (if it was there). More...
|
|
void | cras::stripLeading (::std::string &s, const char &c=' ') |
| Strip c from the start of the given string (if there is one). More...
|
|
::std::string | cras::stripLeading (const ::std::string &s, const char &c=' ') |
| Return a copy of the given string with c removed from its start (if there is one). More...
|
|
void | cras::stripLeadingSlash (::std::string &s, bool warn=false) |
| Strip leading slash from the given string (if there is one). More...
|
|
::std::string | cras::stripLeadingSlash (const ::std::string &s, bool warn=false) |
| Return a copy of the given string with leading slash removed (if there is one). More...
|
|
void | cras::stripTrailing (::std::string &s, const char &c=' ') |
| Strip c from the end of the given string (if there is one). More...
|
|
::std::string | cras::stripTrailing (const ::std::string &s, const char &c=' ') |
| Return a copy of the given string with c removed from its end (if there is one). More...
|
|
template<typename T > |
decltype(::std::to_string(::std::declval< T >())) | cras::to_string (const T &value) |
| Convert the given value to a string representation. More...
|
|
template<typename T > |
decltype(static_cast<::std::string >(::std::declval< T >())) | cras::to_string (const T &value) |
| Convert the given value to a string representation. More...
|
|
inline ::std::string | cras::to_string (const double &value) |
|
inline ::std::string | cras::to_string (const float &value) |
|
inline ::std::string | cras::to_string (const long double &value) |
|
inline ::std::string | cras::to_string (const char *value) |
|
inline ::std::string | cras::to_string (char *value) |
|
template<int I> |
inline ::std::string | cras::to_string (const char value[I]) |
|
inline ::std::string | cras::to_string (const bool &value) |
|
inline ::std::string | cras::to_string (const ::std::string &value) |
|
template<typename K , typename V > |
inline ::std::string | cras::to_string (const ::std::map< K, V > &value) |
|
template<typename K , typename V > |
inline ::std::string | cras::to_string (const ::std::unordered_map< K, V > &value) |
|
template<typename T , size_t N> |
inline ::std::string | cras::to_string (const ::std::array< T, N > &value) |
|
::std::string | cras::toLower (const ::std::string &str) |
| Convert all characters in the given string to lower case. More...
|
|
::std::string | cras::toUpper (const ::std::string &str) |
| Convert all characters in the given string to upper case. More...
|
|
Utils for working with strings.
- Author
- Martin Pecka SPDX-License-Identifier: BSD-3-Clause SPDX-FileCopyrightText: Czech Technical University in Prague
Definition in file string_utils.hpp.