1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <!DOCTYPE library PUBLIC
"-//Boost//DTD BoostBook XML V1.0//EN"
3 "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
5 <!-- Copyright (c) 2002-2006 Pavol Droba.
6 Subject to the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
10 <section id=
"string_algo.quickref" last-revision=
"$Date$">
11 <title>Quick Reference
</title>
13 <using-namespace name=
"boost"/>
14 <using-namespace name=
"boost::algorithm"/>
17 <title>Algorithms
</title>
20 <title>Case Conversion
</title>
21 <tgroup cols=
"3" align=
"left">
24 <entry>Algorithm name
</entry>
25 <entry>Description
</entry>
26 <entry>Functions
</entry>
31 <entry><code>to_upper
</code></entry>
32 <entry>Convert a string to upper case
</entry>
34 <functionname>to_upper_copy()
</functionname>
36 <functionname>to_upper()
</functionname>
40 <entry><code>to_lower
</code></entry>
41 <entry>Convert a string to lower case
</entry>
43 <functionname>to_lower_copy()
</functionname>
45 <functionname>to_lower()
</functionname>
52 <title>Trimming
</title>
53 <tgroup cols=
"3" align=
"left">
56 <entry>Algorithm name
</entry>
57 <entry>Description
</entry>
58 <entry>Functions
</entry>
63 <entry><code>trim_left
</code></entry>
64 <entry>Remove leading spaces from a string
</entry>
66 <functionname>trim_left_copy_if()
</functionname>
68 <functionname>trim_left_if()
</functionname>
70 <functionname>trim_left_copy()
</functionname>
72 <functionname>trim_left()
</functionname>
76 <entry><code>trim_right
</code></entry>
77 <entry>Remove trailing spaces from a string
</entry>
79 <functionname>trim_right_copy_if()
</functionname>
81 <functionname>trim_right_if()
</functionname>
83 <functionname>trim_right_copy()
</functionname>
85 <functionname>trim_right()
</functionname>
89 <entry><code>trim
</code></entry>
90 <entry>Remove leading and trailing spaces from a string
</entry>
92 <functionname>trim_copy_if()
</functionname>
94 <functionname>trim_if()
</functionname>
96 <functionname>trim_copy()
</functionname>
98 <functionname>trim()
</functionname>
106 <title>Predicates
</title>
107 <tgroup cols=
"3" align=
"left">
110 <entry>Algorithm name
</entry>
111 <entry>Description
</entry>
112 <entry>Functions
</entry>
117 <entry><code>starts_with
</code></entry>
118 <entry>Check if a string is a prefix of the other one
</entry>
120 <functionname>starts_with()
</functionname>
122 <functionname>istarts_with()
</functionname>
126 <entry><code>ends_with
</code></entry>
127 <entry>Check if a string is a suffix of the other one
</entry>
129 <functionname>ends_with()
</functionname>
131 <functionname>iends_with()
</functionname>
135 <entry><code>contains
</code></entry>
136 <entry>Check if a string is contained of the other one
</entry>
138 <functionname>contains()
</functionname>
140 <functionname>icontains()
</functionname>
144 <entry><code>equals
</code></entry>
145 <entry>Check if two strings are equal
</entry>
147 <functionname>equals()
</functionname>
149 <functionname>iequals()
</functionname>
153 <entry><code>lexicographical_compare
</code></entry>
154 <entry>Check if a string is lexicographically less then another one
</entry>
156 <functionname>lexicographical_compare()
</functionname>
158 <functionname>ilexicographical_compare()
</functionname>
163 <entry><code>all
</code></entry>
164 <entry>Check if all elements of a string satisfy the given predicate
</entry>
166 <functionname>all()
</functionname>
173 <title>Find algorithms
</title>
174 <tgroup cols=
"3" align=
"left">
177 <entry>Algorithm name
</entry>
178 <entry>Description
</entry>
179 <entry>Functions
</entry>
184 <entry>find_first
</entry>
185 <entry>Find the first occurrence of a string in the input
</entry>
187 <functionname>find_first()
</functionname>
189 <functionname>ifind_first()
</functionname>
193 <entry>find_last
</entry>
194 <entry>Find the last occurrence of a string in the input
</entry>
196 <functionname>find_last()
</functionname>
198 <functionname>ifind_last()
</functionname>
202 <entry>find_nth
</entry>
203 <entry>Find the nth (zero-indexed) occurrence of a string in the input
</entry>
205 <functionname>find_nth()
</functionname>
207 <functionname>ifind_nth()
</functionname>
211 <entry>find_head
</entry>
212 <entry>Retrieve the head of a string
</entry>
214 <functionname>find_head()
</functionname>
218 <entry>find_tail
</entry>
219 <entry>Retrieve the tail of a string
</entry>
221 <functionname>find_tail()
</functionname>
225 <entry>find_token
</entry>
226 <entry>Find first matching token in the string
</entry>
228 <functionname>find_token()
</functionname>
232 <entry>find_regex
</entry>
233 <entry>Use the regular expression to search the string
</entry>
235 <functionname>find_regex()
</functionname>
240 <entry>Generic find algorithm
</entry>
242 <functionname>find()
</functionname>
249 <title>Erase/Replace
</title>
250 <tgroup cols=
"3" align=
"left">
253 <entry>Algorithm name
</entry>
254 <entry>Description
</entry>
255 <entry>Functions
</entry>
260 <entry>replace/erase_first
</entry>
261 <entry>Replace/Erase the first occurrence of a string in the input
</entry>
263 <functionname>replace_first()
</functionname>
265 <functionname>replace_first_copy()
</functionname>
267 <functionname>ireplace_first()
</functionname>
269 <functionname>ireplace_first_copy()
</functionname>
271 <functionname>erase_first()
</functionname>
273 <functionname>erase_first_copy()
</functionname>
275 <functionname>ierase_first()
</functionname>
277 <functionname>ierase_first_copy()
</functionname>
281 <entry>replace/erase_last
</entry>
282 <entry>Replace/Erase the last occurrence of a string in the input
</entry>
284 <functionname>replace_last()
</functionname>
286 <functionname>replace_last_copy()
</functionname>
288 <functionname>ireplace_last()
</functionname>
290 <functionname>ireplace_last_copy()
</functionname>
292 <functionname>erase_last()
</functionname>
294 <functionname>erase_last_copy()
</functionname>
296 <functionname>ierase_last()
</functionname>
298 <functionname>ierase_last_copy()
</functionname>
302 <entry>replace/erase_nth
</entry>
303 <entry>Replace/Erase the nth (zero-indexed) occurrence of a string in the input
</entry>
305 <functionname>replace_nth()
</functionname>
307 <functionname>replace_nth_copy()
</functionname>
309 <functionname>ireplace_nth()
</functionname>
311 <functionname>ireplace_nth_copy()
</functionname>
313 <functionname>erase_nth()
</functionname>
315 <functionname>erase_nth_copy()
</functionname>
317 <functionname>ierase_nth()
</functionname>
319 <functionname>ierase_nth_copy()
</functionname>
323 <entry>replace/erase_all
</entry>
324 <entry>Replace/Erase the all occurrences of a string in the input
</entry>
326 <functionname>replace_all()
</functionname>
328 <functionname>replace_all_copy()
</functionname>
330 <functionname>ireplace_all()
</functionname>
332 <functionname>ireplace_all_copy()
</functionname>
334 <functionname>erase_all()
</functionname>
336 <functionname>erase_all_copy()
</functionname>
338 <functionname>ierase_all()
</functionname>
340 <functionname>ierase_all_copy()
</functionname>
344 <entry>replace/erase_head
</entry>
345 <entry>Replace/Erase the head of the input
</entry>
347 <functionname>replace_head()
</functionname>
349 <functionname>replace_head_copy()
</functionname>
351 <functionname>erase_head()
</functionname>
353 <functionname>erase_head_copy()
</functionname>
358 <entry>replace/erase_tail
</entry>
359 <entry>Replace/Erase the tail of the input
</entry>
361 <functionname>replace_tail()
</functionname>
363 <functionname>replace_tail_copy()
</functionname>
365 <functionname>erase_tail()
</functionname>
367 <functionname>erase_tail_copy()
</functionname>
372 <entry>replace/erase_regex
</entry>
373 <entry>Replace/Erase a substring matching the given regular expression
</entry>
375 <functionname>replace_regex()
</functionname>
377 <functionname>replace_regex_copy()
</functionname>
379 <functionname>erase_regex()
</functionname>
381 <functionname>erase_regex_copy()
</functionname>
386 <entry>replace/erase_regex_all
</entry>
387 <entry>Replace/Erase all substrings matching the given regular expression
</entry>
389 <functionname>replace_all_regex()
</functionname>
391 <functionname>replace_all_regex_copy()
</functionname>
393 <functionname>erase_all_regex()
</functionname>
395 <functionname>erase_all_regex_copy()
</functionname>
400 <entry>find_format
</entry>
401 <entry>Generic replace algorithm
</entry>
403 <functionname>find_format()
</functionname>
405 <functionname>find_format_copy()
</functionname>
407 <functionname>find_format_all()
</functionname>
409 <functionname>find_format_all_copy()()
</functionname>
417 <tgroup cols=
"3" align=
"left">
420 <entry>Algorithm name
</entry>
421 <entry>Description
</entry>
422 <entry>Functions
</entry>
427 <entry>find_all
</entry>
428 <entry>Find/Extract all matching substrings in the input
</entry>
430 <functionname>find_all()
</functionname>
432 <functionname>ifind_all()
</functionname>
434 <functionname>find_all_regex()
</functionname>
439 <entry>Split input into parts
</entry>
441 <functionname>split()
</functionname>
443 <functionname>split_regex()
</functionname>
447 <entry>iter_find
</entry>
448 <entry>Iteratively apply the finder to the input to find all matching substrings
</entry>
450 <functionname>iter_find()
</functionname>
454 <entry>iter_split
</entry>
455 <entry>Use the finder to find matching substrings in the input and use them as separators to split the input into parts
</entry>
457 <functionname>iter_split()
</functionname>
465 <tgroup cols=
"3" align=
"left">
468 <entry>Algorithm name
</entry>
469 <entry>Description
</entry>
470 <entry>Functions
</entry>
476 <entry>Join all elements in a container into a single string
</entry>
478 <functionname>join
</functionname>
482 <entry>join_if
</entry>
483 <entry>Join all elements in a container that satisfies the condition into a single string
</entry>
485 <functionname>join_if()
</functionname>
493 <title>Finders and Formatters
</title>
496 <title>Finders
</title>
497 <tgroup cols=
"3" align=
"left">
500 <entry>Finder
</entry>
501 <entry>Description
</entry>
502 <entry>Generators
</entry>
507 <entry>first_finder
</entry>
508 <entry>Search for the first match of the string in an input
</entry>
510 <functionname>first_finder()
</functionname>
514 <entry>last_finder
</entry>
515 <entry>Search for the last match of the string in an input
</entry>
517 <functionname>last_finder()
</functionname>
521 <entry>nth_finder
</entry>
522 <entry>Search for the nth (zero-indexed) match of the string in an input
</entry>
524 <functionname>nth_finder()
</functionname>
528 <entry>head_finder
</entry>
529 <entry>Retrieve the head of an input
</entry>
531 <functionname>head_finder()
</functionname>
535 <entry>tail_finder
</entry>
536 <entry>Retrieve the tail of an input
</entry>
538 <functionname>tail_finder()
</functionname>
542 <entry>token_finder
</entry>
543 <entry>Search for a matching token in an input
</entry>
545 <functionname>token_finder()
</functionname>
549 <entry>range_finder
</entry>
550 <entry>Do no search, always returns the given range
</entry>
552 <functionname>range_finder()
</functionname>
556 <entry>regex_finder
</entry>
557 <entry>Search for a substring matching the given regex
</entry>
559 <functionname>regex_finder()
</functionname>
567 <title>Formatters
</title>
568 <tgroup cols=
"3" align=
"left">
571 <entry>Formatter
</entry>
572 <entry>Description
</entry>
573 <entry>Generators
</entry>
578 <entry>const_formatter
</entry>
579 <entry>Constant formatter. Always return the specified string
</entry>
581 <functionname>const_formatter()
</functionname>
585 <entry>identity_formatter
</entry>
586 <entry>Identity formatter. Return unmodified input input
</entry>
588 <functionname>identity_formatter()
</functionname>
592 <entry>empty_formatter
</entry>
593 <entry>Null formatter. Always return an empty string
</entry>
595 <functionname>empty_formatter()
</functionname>
599 <entry>regex_formatter
</entry>
600 <entry>Regex formatter. Format regex match using the specification in the format string
</entry>
602 <functionname>regex_formatter()
</functionname>
610 <title>Iterators
</title>
613 <title>Find Iterators
</title>
614 <tgroup cols=
"3" align=
"left">
617 <entry>Iterator name
</entry>
618 <entry>Description
</entry>
619 <entry>Iterator class
</entry>
624 <entry>find_iterator
</entry>
625 <entry>Iterates through matching substrings in the input
</entry>
627 <classname>find_iterator
</classname>
631 <entry>split_iterator
</entry>
632 <entry>Iterates through gaps between matching substrings in the input
</entry>
634 <classname>split_iterator
</classname>
643 <title>Classification
</title>
646 <title>Predicates
</title>
647 <tgroup cols=
"3" align=
"left">
650 <entry>Predicate name
</entry>
651 <entry>Description
</entry>
652 <entry>Generator
</entry>
657 <entry>is_classified
</entry>
658 <entry>Generic
<code>ctype
</code> mask based classification
</entry>
660 <functionname>is_classified()
</functionname>
664 <entry>is_space
</entry>
665 <entry>Recognize spaces
</entry>
667 <functionname>is_space()
</functionname>
671 <entry>is_alnum
</entry>
672 <entry>Recognize alphanumeric characters
</entry>
674 <functionname>is_alnum()
</functionname>
678 <entry>is_alpha
</entry>
679 <entry>Recognize letters
</entry>
681 <functionname>is_alpha()
</functionname>
685 <entry>is_cntrl
</entry>
686 <entry>Recognize control characters
</entry>
688 <functionname>is_cntrl()
</functionname>
692 <entry>is_digit
</entry>
693 <entry>Recognize decimal digits
</entry>
695 <functionname>is_digit()
</functionname>
699 <entry>is_graph
</entry>
700 <entry>Recognize graphical characters
</entry>
702 <functionname>is_graph()
</functionname>
706 <entry>is_lower
</entry>
707 <entry>Recognize lower case characters
</entry>
709 <functionname>is_lower()
</functionname>
713 <entry>is_print
</entry>
714 <entry>Recognize printable characters
</entry>
716 <functionname>is_print()
</functionname>
720 <entry>is_punct
</entry>
721 <entry>Recognize punctuation characters
</entry>
723 <functionname>is_punct()
</functionname>
727 <entry>is_upper
</entry>
728 <entry>Recognize uppercase characters
</entry>
730 <functionname>is_upper()
</functionname>
734 <entry>is_xdigit
</entry>
735 <entry>Recognize hexadecimal digits
</entry>
737 <functionname>is_xdigit()
</functionname>
741 <entry>is_any_of
</entry>
742 <entry>Recognize any of a sequence of characters
</entry>
744 <functionname>is_any_of()
</functionname>
748 <entry>is_from_range
</entry>
749 <entry>Recognize characters inside a min..max range
</entry>
751 <functionname>is_from_range()
</functionname>