...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Table 30.1. Case Conversion
Algorithm name | Description | Functions |
---|---|---|
to_upper |
Convert a string to upper case |
to_upper_copy()
to_upper()
|
to_lower |
Convert a string to lower case |
to_lower_copy()
to_lower()
|
Table 30.2. Trimming
Algorithm name | Description | Functions |
---|---|---|
trim_left |
Remove leading spaces from a string |
trim_left_copy_if()
trim_left_if()
trim_left_copy()
trim_left()
|
trim_right |
Remove trailing spaces from a string |
trim_right_copy_if()
trim_right_if()
trim_right_copy()
trim_right()
|
trim |
Remove leading and trailing spaces from a string |
trim_copy_if()
trim_if()
trim_copy()
trim()
|
Table 30.3. Predicates
Algorithm name | Description | Functions |
---|---|---|
starts_with |
Check if a string is a prefix of the other one |
starts_with()
istarts_with()
|
ends_with |
Check if a string is a suffix of the other one |
ends_with()
iends_with()
|
contains |
Check if a string is contained of the other one |
contains()
icontains()
|
equals |
Check if two strings are equal |
equals()
iequals()
|
lexicographical_compare |
Check if a string is lexicographically less then another one |
lexicographical_compare()
ilexicographical_compare()
|
all |
Check if all elements of a string satisfy the given predicate |
all()
|
Table 30.4. Find algorithms
Algorithm name | Description | Functions |
---|---|---|
find_first | Find the first occurrence of a string in the input |
find_first()
ifind_first()
|
find_last | Find the last occurrence of a string in the input |
find_last()
ifind_last()
|
find_nth | Find the nth (zero-indexed) occurrence of a string in the input |
find_nth()
ifind_nth()
|
find_head | Retrieve the head of a string |
find_head()
|
find_tail | Retrieve the tail of a string |
find_tail()
|
find_token | Find first matching token in the string |
find_token()
|
find_regex | Use the regular expression to search the string |
find_regex()
|
find | Generic find algorithm |
find()
|
Table 30.5. Erase/Replace
Table 30.6. Split
Algorithm name | Description | Functions |
---|---|---|
find_all | Find/Extract all matching substrings in the input |
find_all()
ifind_all()
find_all_regex()
|
split | Split input into parts |
split()
split_regex()
|
iter_find | Iteratively apply the finder to the input to find all matching substrings |
iter_find()
|
iter_split | Use the finder to find matching substrings in the input and use them as separators to split the input into parts |
iter_split()
|
Table 30.8. Finders
Finder | Description | Generators |
---|---|---|
first_finder | Search for the first match of the string in an input |
first_finder()
|
last_finder | Search for the last match of the string in an input |
last_finder()
|
nth_finder | Search for the nth (zero-indexed) match of the string in an input |
nth_finder()
|
head_finder | Retrieve the head of an input |
head_finder()
|
tail_finder | Retrieve the tail of an input |
tail_finder()
|
token_finder | Search for a matching token in an input |
token_finder()
|
range_finder | Do no search, always returns the given range |
range_finder()
|
regex_finder | Search for a substring matching the given regex |
regex_finder()
|
Table 30.9. Formatters
Formatter | Description | Generators |
---|---|---|
const_formatter | Constant formatter. Always return the specified string |
const_formatter()
|
identity_formatter | Identity formatter. Return unmodified input input |
identity_formatter()
|
empty_formatter | Null formatter. Always return an empty string |
empty_formatter()
|
regex_formatter | Regex formatter. Format regex match using the specification in the format string |
regex_formatter()
|
Table 30.10. Find Iterators
Iterator name | Description | Iterator class |
---|---|---|
find_iterator | Iterates through matching substrings in the input |
find_iterator
|
split_iterator | Iterates through gaps between matching substrings in the input |
split_iterator
|
Table 30.11. Predicates
Predicate name | Description | Generator |
---|---|---|
is_classified | Generic ctype mask based classification |
is_classified()
|
is_space | Recognize spaces |
is_space()
|
is_alnum | Recognize alphanumeric characters |
is_alnum()
|
is_alpha | Recognize letters |
is_alpha()
|
is_cntrl | Recognize control characters |
is_cntrl()
|
is_digit | Recognize decimal digits |
is_digit()
|
is_graph | Recognize graphical characters |
is_graph()
|
is_lower | Recognize lower case characters |
is_lower()
|
is_print | Recognize printable characters |
is_print()
|
is_punct | Recognize punctuation characters |
is_punct()
|
is_upper | Recognize uppercase characters |
is_upper()
|
is_xdigit | Recognize hexadecimal digits |
is_xdigit()
|
is_any_of | Recognize any of a sequence of characters |
is_any_of()
|
is_from_range | Recognize characters inside a min..max range |
is_from_range()
|