|
BenBot 1.7.5
A chess engine
|
Files | |
| file | Strings.hpp |
| file | TextTable.hpp |
Namespaces | |
| namespace | util |
| namespace | util::strings |
Classes | |
| struct | util::strings::TextTable |
Typedefs | |
| using | util::strings::StringViewPair = std::pair<string_view, string_view> |
| auto | util::strings::trim (string_view text) -> string_view |
| auto | util::strings::split_at_first_space (string_view input) -> StringViewPair |
| auto | util::strings::split_at_first_space_or_newline (string_view input) -> StringViewPair |
| auto | util::strings::find_matching_close_paren (string_view input) -> std::expected< size_t, std::string > |
| template<std::integral Int> | |
| constexpr auto | util::strings::int_from_string (string_view text, Int defaultValue=0) noexcept -> Int |
| template<size_t MaxLen = 5uz> | |
| void | util::strings::write_integer (std::integral auto value, std::string &output) |
| auto | util::strings::split_by_delim (string_view text, char delim) |
| auto | util::strings::lines_view (string_view text) |
| auto | util::strings::words_view (string_view text) |
String handling utility functions used throughout the code.
| using util::strings::StringViewPair = std::pair<string_view, string_view> |
Utility typedef for a pair of string views.
Definition at line 52 of file Strings.hpp.
|
nodiscard |
For a string beginning with (, finds the index of the matching ) character, taking nested () pairs into account. This function asserts if the input does not begin with (.
If a matching close parentheses character isn't found, returns an explanatory error string.
|
nodiscardconstexprnoexcept |
Reads an integer from the input string using std::from_chars.
Definition at line 153 of file Strings.hpp.
|
inlinenodiscard |
Returns a range of string_views, each representing a line from the input string.
Definition at line 192 of file Strings.hpp.
|
nodiscard |
Splits the input string into segments before and after the first whitespace character. If there is no whitespace in the input string, the returned pair contains a copy of the input string and an empty string_view. If the first character of the input string is a space, the first element of the returned pair is an empty string_view.
|
nodiscard |
Similar to split_at_first_space(), but also splits on newlines.
|
inlinenodiscard |
Returns a range of string_views created by splitting the input text at the given delimiter.
Definition at line 185 of file Strings.hpp.
|
nodiscard |
Trims any whitespace characters from the beginning and ending of the string, including space and newline characters.
|
inlinenodiscard |
Returns a range of string_views, each representing a word from the input string.
Definition at line 197 of file Strings.hpp.
| void util::strings::write_integer | ( | std::integral auto | value, |
| std::string & | output ) |
Appends an integer to the output string using std::to_chars. This function uses stack memory for to_chars() to write into. If to_chars() returns an error, output is not changed.
| MaxLen | The maximum number of characters that will be written to output. |
Definition at line 165 of file Strings.hpp.