|
CPP-TOOLBOX
|
Classes | |
| class | MultilineStringAccumulator |
| struct | Node |
| class | StringAccumulator |
Functions | |
| std::string | remove_consecutive_duplicates (const std::string &input, const std::string &dedup_chars="") |
| Remove consecutive duplicate characters from a string. | |
| std::string | abbreviate_snake_case (const std::string &input) |
| Abbreviate a snake_case string by shortening each word. | |
| bool | is_integer (const std::string &str) |
| Check if a string represents an integer. | |
| bool | is_rational (const std::string &str) |
| Check if a string represents a rational (floating-point) number. | |
| std::string | add_newlines_to_long_string (const std::string &text, size_t max_chars_per_line=25) |
| Insert newlines into long strings. | |
| std::vector< std::string > | split (const std::string &str, const std::string &delimiter) |
| Split a string by a delimiter. | |
| std::vector< std::string > | split_once_from_right (const std::string &str, const std::string &delimiter) |
| Split a string once from the right. | |
| std::string | join (const std::vector< std::string > &elements, const std::string &separator) |
| Join elements into a single string with a separator. | |
| std::string | trim (const std::string &s) |
| Trim whitespace from both ends of a string. | |
| std::string | pascal_to_snake_case (const std::string &input) |
| Convert a PascalCase string to snake_case. | |
| std::string | snake_to_pascal_case (const std::string &input) |
| Convert a snake_case string to PascalCase. | |
| std::string | join_multiline (const std::string &input, bool replace_newlines_with_space=false) |
| Join a string with newlines removed or replaced. | |
| std::string | replace_char (const std::string &input, char from_char, char to_char) |
| Replace a character with another in a string. | |
| std::string | replace_chars (const std::string &input, const std::unordered_map< char, char > &mapping) |
| Replace characters in a string according to a mapping. | |
| std::string | replace_substring (const std::string &input, const std::string &from_substr, const std::string &to_substr) |
| Replace all occurrences of a substring with another substring. | |
| bool | starts_with (const std::string &str, const std::string &prefix) |
| Check if a string starts with a prefix. | |
| bool | contains (const std::string &str, const std::string &substr) |
| Check if a string contains a substring. | |
| std::string | get_substring (const std::string &input, size_t start, size_t end) |
| Extract a substring from start to end indices. | |
| std::string | remove_newlines (const std::string &input) |
| Remove all newlines from a string. | |
| std::string | collapse_whitespace (const std::string &input) |
| Collapse consecutive whitespace into a single space. | |
| std::string | replace_literal_newlines_with_real (const std::string &input) |
| Replace literal "\n" sequences with real newlines. | |
| std::string | indent (const std::string &text, int indent_level, int spaces_per_indent=4) |
| Indent text by a given number of levels. | |
| std::string | surround (const std::string &str, const std::string &left, const std::string &right="") |
| Surround a string with left and right substrings. | |
| std::string | generate_abbreviation (const std::string &snake_case_name) |
| std::string | generate_unique_abbreviation (std::unordered_map< std::string, std::string > ¤t_abbreviation_map, const std::string &word_to_abbreviate) |
| std::unordered_map< std::string, std::string > | map_words_to_abbreviations (const std::vector< std::string > &words) |
| Create a map from words to their abbreviations. | |
| std::string | parse_token (const std::string &s, size_t &pos) |
| Node | parse_block (const std::string &s, size_t &pos) |
| std::vector< std::string > | build_buffer (const Node &node) |
| std::string | format_nested_brace_string_recursive (const std::string &input) |
Variables | |
| const std::string | double_quote = "\"" |
| const std::string | single_quote = "'" |
| const std::string | newline = "\n" |
| const std::string | tab = "\t" |
| const std::string | space = " " |
| const std::string | empty = "" |
| const std::string | comma = "," |
| const std::string | period = "." |
| const std::string | colon = ":" |
| const std::string | semicolon = ";" |
| const std::string | dash = "-" |
| const std::string | underscore = "_" |
| const std::string | slash = "/" |
| const std::string | backslash = "\\" |
| const std::string | pipe = "|" |
| const std::string | ampersand = "&" |
| const std::string | at_sign = "@" |
| const std::string | hash = "#" |
| const std::string | dollar = "$" |
| const std::string | percent = "%" |
| const std::string | caret = "^" |
| const std::string | asterisk = "*" |
| const std::string | plus = "+" |
| const std::string | equals = "=" |
| const std::string | question_mark = "?" |
| const std::string | exclamation_mark = "!" |
| const std::string | left_paren = "(" |
| const std::string | right_paren = ")" |
| const std::string | left_bracket = "[" |
| const std::string | right_bracket = "]" |
| const std::string | left_brace = "{" |
| const std::string | right_brace = "}" |
| const std::string | less_than = "<" |
| const std::string | greater_than = ">" |
| const std::string | newline_windows = "\r\n" |
| const std::string | carriage_return = "\r" |
| const std::string | natural_numbers = "ℕ" |
| const std::string | element_of = "∈" |
| std::string text_utils::abbreviate_snake_case | ( | const std::string & | input | ) |
Abbreviate a snake_case string by shortening each word.
| input | Input snake_case string. |
| std::string text_utils::add_newlines_to_long_string | ( | const std::string & | text, |
| size_t | max_chars_per_line = 25 ) |
Insert newlines into long strings.
| text | Input string. |
| max_chars_per_line | Maximum characters per line. |
| std::vector< std::string > text_utils::build_buffer | ( | const Node & | node | ) |
| std::string text_utils::collapse_whitespace | ( | const std::string & | input | ) |
Collapse consecutive whitespace into a single space.
| bool text_utils::contains | ( | const std::string & | str, |
| const std::string & | substr ) |
Check if a string contains a substring.
| std::string text_utils::format_nested_brace_string_recursive | ( | const std::string & | input | ) |
| std::string text_utils::generate_abbreviation | ( | const std::string & | snake_case_name | ) |
| std::string text_utils::generate_unique_abbreviation | ( | std::unordered_map< std::string, std::string > & | current_abbreviation_map, |
| const std::string & | word_to_abbreviate ) |
| std::string text_utils::get_substring | ( | const std::string & | input, |
| size_t | start, | ||
| size_t | end ) |
Extract a substring from start to end indices.
| std::string text_utils::indent | ( | const std::string & | text, |
| int | indent_level, | ||
| int | spaces_per_indent = 4 ) |
Indent text by a given number of levels.
| text | Input string. |
| indent_level | Indentation level. |
| spaces_per_indent | Number of spaces per level. |
| bool text_utils::is_integer | ( | const std::string & | str | ) |
Check if a string represents an integer.
| bool text_utils::is_rational | ( | const std::string & | value | ) |
Check if a string represents a rational (floating-point) number.
| std::string text_utils::join | ( | const std::vector< std::string > & | elements, |
| const std::string & | separator ) |
Join elements into a single string with a separator.
| elements | Vector of strings. |
| separator | Separator string. |
| std::string text_utils::join_multiline | ( | const std::string & | input, |
| bool | replace_newlines_with_space = false ) |
Join a string with newlines removed or replaced.
| input | Input string with multiple lines. |
| replace_newlines_with_space | Whether to replace newlines with spaces. |
| std::unordered_map< std::string, std::string > text_utils::map_words_to_abbreviations | ( | const std::vector< std::string > & | words | ) |
Create a map from words to their abbreviations.
| words | List of words. |
| Node text_utils::parse_block | ( | const std::string & | s, |
| size_t & | pos ) |
| std::string text_utils::parse_token | ( | const std::string & | s, |
| size_t & | pos ) |
| std::string text_utils::pascal_to_snake_case | ( | const std::string & | input | ) |
Convert a PascalCase string to snake_case.
| input | Input PascalCase string. |
| std::string text_utils::remove_consecutive_duplicates | ( | const std::string & | input, |
| const std::string & | dedup_chars = "" ) |
Remove consecutive duplicate characters from a string.
| input | Input string. |
| dedup_chars | Characters to deduplicate (empty = all). |
| std::string text_utils::remove_newlines | ( | const std::string & | input | ) |
Remove all newlines from a string.
| std::string text_utils::replace_char | ( | const std::string & | input, |
| char | from_char, | ||
| char | to_char ) |
Replace a character with another in a string.
| std::string text_utils::replace_chars | ( | const std::string & | input, |
| const std::unordered_map< char, char > & | mapping ) |
Replace characters in a string according to a mapping.
| std::string text_utils::replace_literal_newlines_with_real | ( | const std::string & | input | ) |
Replace literal "\n" sequences with real newlines.
| std::string text_utils::replace_substring | ( | const std::string & | input, |
| const std::string & | from_substr, | ||
| const std::string & | to_substr ) |
Replace all occurrences of a substring with another substring.
| std::string text_utils::snake_to_pascal_case | ( | const std::string & | input | ) |
Convert a snake_case string to PascalCase.
| input | Input snake_case string. |
| std::vector< std::string > text_utils::split | ( | const std::string & | str, |
| const std::string & | delimiter ) |
Split a string by a delimiter.
| str | Input string. |
| delimiter | Delimiter string. |
| std::vector< std::string > text_utils::split_once_from_right | ( | const std::string & | str, |
| const std::string & | delimiter ) |
Split a string once from the right.
| str | Input string. |
| delimiter | Delimiter string. |
| bool text_utils::starts_with | ( | const std::string & | str, |
| const std::string & | prefix ) |
Check if a string starts with a prefix.
| std::string text_utils::surround | ( | const std::string & | str, |
| const std::string & | left, | ||
| const std::string & | right = "" ) |
Surround a string with left and right substrings.
| str | Input string. |
| left | Left surround string. |
| right | Right surround string (default empty). |
| std::string text_utils::trim | ( | const std::string & | s | ) |
Trim whitespace from both ends of a string.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |