|
Maze Builder Docs 7.5.6
|
String helper class. More...
#include <string_utils.h>
Static Public Member Functions | |
| static std::string | concat (const std::string &a, const std::string &b) noexcept |
| Combine and return two strings. | |
| static bool | contains (const std::string &str, const std::string &substr) noexcept |
| Check if a string contains a substring. | |
| static std::string | get_file_extension (const std::string &filename) noexcept |
| Extract file extension from a filename. | |
| static bool | ends_with (const std::string &str, const std::string &suffix) noexcept |
| Check if a string ends with a specific suffix. | |
| static bool | find (std::string_view sv, char c) noexcept |
| Find a character in a string_view. | |
| static std::string_view | find_first_of (const std::string_view &s, const std::string_view &chars) noexcept |
| Find the first occurrence of any character from a set in a string view. | |
| static std::string_view | strip (const std::string_view &s, const std::string_view &to_strip_from_s=" ") noexcept |
| Strip specific characters from the beginning and end of a string view. | |
| template<typename It , typename Oc , typename V , typename Pred > | |
| static It | split (It it, const It end_it, Oc &dest, const V &sep, Pred f) |
| Splits a range into slices based on a separator and stores the results in a destination container. | |
| template<typename It , typename Oc , typename V > | |
| static It | split (It it, const It end_it, Oc &dest, const V &sep) |
| Generic split function with default equality predicate. | |
| template<typename Cin , typename Cout , typename V > | |
| static Cout & | strsplit (const Cin &str, Cout &dest, const V &sep) |
| High-level string split function using containers. | |
| template<typename T > | |
| static bool | is_whitespace (const T &c) |
| Checks if a character is a whitespace character. | |
| static std::string | strip_whitespace (const std::string &s) |
| Removes consecutive whitespace characters from a string, leaving only single whitespace between non-whitespace characters. | |
| template<typename... Args> | |
| static std::string | format (std::string_view format_str, const Args &...args) noexcept |
| Simple wrapper for fmt::format using runtime format strings (string_view) | |
String helper class.
This class provides common string manipulation utilities ://github.com/PacktPublishing/CPP-20-STL-Cookbook/blob/main/chap11/split.cpp
|
staticnoexcept |
Combine and return two strings.
| a | The first string |
| b | The second string |
|
staticnoexcept |
Check if a string contains a substring.
| str | The string to search in |
| substr | The substring to search for |
|
staticnoexcept |
Check if a string ends with a specific suffix.
| str | The string to check |
| suffix | The suffix to check for |
|
staticnoexcept |
Find a character in a string_view.
| sv | The string_view to search in |
| c | The character to search for |
|
staticnoexcept |
Find the first occurrence of any character from a set in a string view.
| s | The string view to search in |
| chars | The set of characters to search for |
|
staticnoexcept |
Simple wrapper for fmt::format using runtime format strings (string_view)
| Args | Types of the arguments to format |
| format_str | Format string as string_view |
| args | Arguments to format |
|
staticnoexcept |
Extract file extension from a filename.
| filename | The filename to process |
|
inlinestatic |
Checks if a character is a whitespace character.
| T | The type of the character to check. |
| c | The character to check for whitespace. |
|
inlinestatic |
Generic split function with default equality predicate.
| It | Iterator type |
| Oc | Output container type |
| V | Value type |
| it | Start iterator |
| end_it | End iterator |
| dest | Output container |
| sep | Separator value |
|
inlinestatic |
Splits a range into slices based on a separator and stores the results in a destination container.
| It | Type of the iterator for the input range. |
| Oc | Type of the output container that will store the slices. |
| V | Type of the separator value. |
| Pred | Type of the predicate function used to compare elements to the separator. |
| it | Iterator pointing to the beginning of the range to split. |
| end_it | Iterator pointing to the end of the range to split. |
| dest | Destination container where the resulting slices will be stored. |
| sep | Separator value used to determine where to split the range. |
| f | Predicate function that determines if an element matches the separator. |
|
staticnoexcept |
Strip specific characters from the beginning and end of a string view.
| s | The string view to strip characters from |
| to_strip_from_s | The character to strip |
|
inlinestatic |
Removes consecutive whitespace characters from a string, leaving only single whitespace between non-whitespace characters.
| s | The input string from which to strip consecutive whitespace. |
|
inlinestatic |
High-level string split function using containers.
| Cin | Input container type |
| Cout | Output container type |
| V | Value type |
| str | Input container/string |
| dest | Output container |
| sep | Separator value |