|
template<EWhitespace TYPE = EWhitespace::Common> |
std::string_view | ph::string_utils::get_whitespaces () |
|
template<EWhitespace TYPE = EWhitespace::Common> |
constexpr bool | ph::string_utils::is_whitespace (const char ch) |
|
bool | ph::string_utils::has_any_of (const std::string_view srcStr, const std::string_view candidates) |
|
bool | ph::string_utils::has_none_of (const std::string_view srcStr, const std::string_view candidates) |
|
std::string_view | ph::string_utils::cut_head (const std::string_view srcStr, const std::string_view candidates) |
| Remove characters from the beginning.
|
|
std::string_view | ph::string_utils::cut_tail (const std::string_view srcStr, const std::string_view candidates) |
| Remove characters from the end.
|
|
std::string_view | ph::string_utils::cut_ends (const std::string_view srcStr, const std::string_view candidates) |
| Remove characters from both ends.
|
|
template<EWhitespace TYPE = EWhitespace::Common> |
std::string_view | ph::string_utils::trim_head (const std::string_view srcStr) |
| Remove white spaces from the beginning.
|
|
template<EWhitespace TYPE = EWhitespace::Common> |
std::string_view | ph::string_utils::trim_tail (const std::string_view srcStr) |
| Remove white spaces from the end.
|
|
template<EWhitespace TYPE = EWhitespace::Common> |
std::string_view | ph::string_utils::trim (const std::string_view srcStr) |
| Remove white spaces from both ends.
|
|
std::string_view | ph::string_utils::next_token (std::string_view srcStr, std::string_view *const out_remainingStr=nullptr, const std::string_view tokenSeparators=get_whitespaces<>()) |
| Retrieve a token from a string.
|
|
char | ph::string_utils::az_to_AZ (const char ch) |
| Convert lower-case characters to upper-case.
|
|
char | ph::string_utils::AZ_to_az (const char ch) |
| Convert upper-case characters to lower-case.
|
|
void | ph::string_utils::az_to_AZ (std::string &str) |
| Convert lower-case characters to upper-case.
|
|
void | ph::string_utils::AZ_to_az (std::string &str) |
| Convert upper-case characters to lower-case.
|
|
std::string | ph::string_utils::repeat (const std::string_view str, const std::size_t n) |
| Repeat the input string for N times.
|
|
void | ph::string_utils::erase_all (std::string &str, const char ch) |
| Remove all occurrence of a character in the string.
|
|
void | ph::string_utils::detail_from_to_char::throw_from_std_errc_if_has_error (const std::errc errorCode) |
|
template<typename T > |
T | ph::string_utils::parse_float (const std::string_view floatStr) |
| Returns a float by processing its string representation. Supports float, double, and long double.
|
|
template<typename T > |
T | ph::string_utils::parse_int (std::string_view intStr) |
| Returns an integer by processing its string representation. Supports the following:
|
|
template<typename NumberType > |
NumberType | ph::string_utils::parse_number (const std::string_view numberStr) |
| Returns a number by processing its string representation. Accepts all types supported by parse_float(std::string_view) and parse_int(std::string_view).
|
|
template<typename T > |
std::size_t | ph::string_utils::stringify_float (const T value, char *const out_buffer, const std::size_t bufferSize) |
| Converts a float to string.
|
|
template<std::integral T> |
std::size_t | ph::string_utils::stringify_int_alphabetic (const T value, char *const out_buffer, const std::size_t bufferSize, const int base) |
| Converts an integer to base [2, 62] string.
|
|
template<std::integral T> |
std::size_t | ph::string_utils::stringify_int (const T value, char *const out_buffer, const std::size_t bufferSize, const int base=10) |
| Converts an integer to string.
|
|
template<typename NumberType > |
std::size_t | ph::string_utils::stringify_number (const NumberType value, char *const out_buffer, const std::size_t bufferSize) |
| Converts a number to string. Accepts all types supported by stringify_float(T, char*, std::size_t) and stringify_int(T, char*, std::size_t). The written string is not null terminated.
|
|
template<typename NumberType > |
std::string & | ph::string_utils::stringify_number (const NumberType value, std::string &out_str, const std::size_t maxChars=64) |
| Converts a number to string. Similar to stringify_number(NumberType, char*, std::size_t) , except that this variant writes to std::string and the resulting string is guaranteed to be null terminated (by calling std::string::c_str() ).
|
|
template<typename NumberType > |
std::string | ph::string_utils::stringify_number (const NumberType value, const std::size_t maxChars=64) |
| Converts a number to string. Similar to stringify_number(NumberType, std::string&, std::size_t) , except that this variant creates a new string.
|
|
String manipulation helpers.