| 1 | <html> | 
|---|
| 2 | <head> | 
|---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | 
|---|
| 4 | <title>Chapter 14. Boost String Algorithms Library</title> | 
|---|
| 5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> | 
|---|
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> | 
|---|
| 7 | <link rel="start" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> | 
|---|
| 8 | <link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)"> | 
|---|
| 9 | <link rel="prev" href="boost_staticassert/test.html" title=" Test Programs"> | 
|---|
| 10 | <link rel="next" href="string_algo/release_notes.html" title="Release Notes"> | 
|---|
| 11 | </head> | 
|---|
| 12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | 
|---|
| 13 | <table cellpadding="2" width="100%"> | 
|---|
| 14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> | 
|---|
| 15 | <td align="center"><a href="../../index.htm">Home</a></td> | 
|---|
| 16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> | 
|---|
| 17 | <td align="center"><a href="../../people/people.htm">People</a></td> | 
|---|
| 18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> | 
|---|
| 19 | <td align="center"><a href="../../more/index.htm">More</a></td> | 
|---|
| 20 | </table> | 
|---|
| 21 | <hr> | 
|---|
| 22 | <div class="spirit-nav"> | 
|---|
| 23 | <a accesskey="p" href="boost_staticassert/test.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="string_algo/release_notes.html"><img src="images/next.png" alt="Next"></a> | 
|---|
| 24 | </div> | 
|---|
| 25 | <div class="chapter" lang="en"> | 
|---|
| 26 | <div class="titlepage"><div> | 
|---|
| 27 | <div><h2 class="title"> | 
|---|
| 28 | <a name="string_algo"></a>Chapter 14. Boost String Algorithms Library</h2></div> | 
|---|
| 29 | <div><div class="author"><h3 class="author"> | 
|---|
| 30 | <span class="firstname">Pavol</span> <span class="surname">Droba</span> | 
|---|
| 31 | </h3></div></div> | 
|---|
| 32 | <div><p class="copyright">Copyright © 2002-2004 Pavol Droba</p></div> | 
|---|
| 33 | <div><div class="legalnotice"> | 
|---|
| 34 | <a name="id1637442"></a><p>Use, modification and distribution is subject to the Boost | 
|---|
| 35 |                 Software License, Version 1.0. (See accompanying file | 
|---|
| 36 |                 <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) | 
|---|
| 37 |             </p> | 
|---|
| 38 | </div></div> | 
|---|
| 39 | </div></div> | 
|---|
| 40 | <div class="toc"> | 
|---|
| 41 | <p><b>Table of Contents</b></p> | 
|---|
| 42 | <dl> | 
|---|
| 43 | <dt><span class="section"><a href="string_algo.html#string_algo.intro">Introduction</a></span></dt> | 
|---|
| 44 | <dt><span class="section"><a href="string_algo/release_notes.html">Release Notes</a></span></dt> | 
|---|
| 45 | <dt><span class="section"><a href="string_algo/usage.html">Usage</a></span></dt> | 
|---|
| 46 | <dd><dl> | 
|---|
| 47 | <dt><span class="section"><a href="string_algo/usage.html#id1637783">First Example</a></span></dt> | 
|---|
| 48 | <dt><span class="section"><a href="string_algo/usage.html#id1637979">Case conversion</a></span></dt> | 
|---|
| 49 | <dt><span class="section"><a href="string_algo/usage.html#id1638044">Predicates and Classification</a></span></dt> | 
|---|
| 50 | <dt><span class="section"><a href="string_algo/usage.html#id1638126">Trimming</a></span></dt> | 
|---|
| 51 | <dt><span class="section"><a href="string_algo/usage.html#id1638194">Find algorithms</a></span></dt> | 
|---|
| 52 | <dt><span class="section"><a href="string_algo/usage.html#id1638314">Replace Algorithms</a></span></dt> | 
|---|
| 53 | <dt><span class="section"><a href="string_algo/usage.html#id1638440">Find Iterator</a></span></dt> | 
|---|
| 54 | <dt><span class="section"><a href="string_algo/usage.html#id1638536">Split</a></span></dt> | 
|---|
| 55 | </dl></dd> | 
|---|
| 56 | <dt><span class="section"><a href="string_algo/quickref.html">Quick Reference</a></span></dt> | 
|---|
| 57 | <dd><dl> | 
|---|
| 58 | <dt><span class="section"><a href="string_algo/quickref.html#id1638678">Algorithms</a></span></dt> | 
|---|
| 59 | <dt><span class="section"><a href="string_algo/quickref.html#id1640737">Finders and Formatters</a></span></dt> | 
|---|
| 60 | <dt><span class="section"><a href="string_algo/quickref.html#id1641122">Iterators</a></span></dt> | 
|---|
| 61 | <dt><span class="section"><a href="string_algo/quickref.html#id1641212">Classification</a></span></dt> | 
|---|
| 62 | </dl></dd> | 
|---|
| 63 | <dt><span class="section"><a href="string_algo/design.html">Design Topics</a></span></dt> | 
|---|
| 64 | <dd><dl> | 
|---|
| 65 | <dt><span class="section"><a href="string_algo/design.html#string_algo.string">String Representation</a></span></dt> | 
|---|
| 66 | <dt><span class="section"><a href="string_algo/design.html#string_algo.sequence_traits">Sequence Traits</a></span></dt> | 
|---|
| 67 | <dt><span class="section"><a href="string_algo/design.html#string_algo.find">Find Algorithms</a></span></dt> | 
|---|
| 68 | <dt><span class="section"><a href="string_algo/design.html#string_algo.replace">Replace Algorithms</a></span></dt> | 
|---|
| 69 | <dt><span class="section"><a href="string_algo/design.html#string_algo.split">Find Iterators & Split Algorithms</a></span></dt> | 
|---|
| 70 | <dt><span class="section"><a href="string_algo/design.html#string_algo.exception">Exception Safety</a></span></dt> | 
|---|
| 71 | </dl></dd> | 
|---|
| 72 | <dt><span class="section"><a href="string_algo/concept.html">Concepts</a></span></dt> | 
|---|
| 73 | <dd><dl> | 
|---|
| 74 | <dt><span class="section"><a href="string_algo/concept.html#id1642149">Definitions</a></span></dt> | 
|---|
| 75 | <dt><span class="section"><a href="string_algo/concept.html#string_algo.finder_concept">Finder Concept</a></span></dt> | 
|---|
| 76 | <dt><span class="section"><a href="string_algo/concept.html#string_algo.formatter_concept">Formatter concept</a></span></dt> | 
|---|
| 77 | </dl></dd> | 
|---|
| 78 | <dt><span class="section"><a href="string_algo/reference.html">Reference</a></span></dt> | 
|---|
| 79 | <dd><dl> | 
|---|
| 80 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.case_conv.hpp">Header <boost/algorithm/string/case_conv.hpp></a></span></dt> | 
|---|
| 81 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.classification.hpp">Header <boost/algorithm/string/classification.hpp></a></span></dt> | 
|---|
| 82 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.compare.hpp">Header <boost/algorithm/string/compare.hpp></a></span></dt> | 
|---|
| 83 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.concept.hpp">Header <boost/algorithm/string/concept.hpp></a></span></dt> | 
|---|
| 84 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.constants.hpp">Header <boost/algorithm/string/constants.hpp></a></span></dt> | 
|---|
| 85 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.erase.hpp">Header <boost/algorithm/string/erase.hpp></a></span></dt> | 
|---|
| 86 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.find.hpp">Header <boost/algorithm/string/find.hpp></a></span></dt> | 
|---|
| 87 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.find_format.hpp">Header <boost/algorithm/string/find_format.hpp></a></span></dt> | 
|---|
| 88 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.find_iterator.hpp">Header <boost/algorithm/string/find_iterator.hpp></a></span></dt> | 
|---|
| 89 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.finder.hpp">Header <boost/algorithm/string/finder.hpp></a></span></dt> | 
|---|
| 90 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.formatter.hpp">Header <boost/algorithm/string/formatter.hpp></a></span></dt> | 
|---|
| 91 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.iter_find.hpp">Header <boost/algorithm/string/iter_find.hpp></a></span></dt> | 
|---|
| 92 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.join.hpp">Header <boost/algorithm/string/join.hpp></a></span></dt> | 
|---|
| 93 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.predicate.hpp">Header <boost/algorithm/string/predicate.hpp></a></span></dt> | 
|---|
| 94 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.regex.hpp">Header <boost/algorithm/string/regex.hpp></a></span></dt> | 
|---|
| 95 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.regex_find_format.hpp">Header <boost/algorithm/string/regex_find_format.hpp></a></span></dt> | 
|---|
| 96 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.replace.hpp">Header <boost/algorithm/string/replace.hpp></a></span></dt> | 
|---|
| 97 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.sequence_traits.hpp">Header <boost/algorithm/string/sequence_traits.hpp></a></span></dt> | 
|---|
| 98 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.split.hpp">Header <boost/algorithm/string/split.hpp></a></span></dt> | 
|---|
| 99 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.std_containers_traits.hpp">Header <boost/algorithm/string/std_containers_traits.hpp></a></span></dt> | 
|---|
| 100 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.hpp">Header <boost/algorithm/string.hpp></a></span></dt> | 
|---|
| 101 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string_regex.hpp">Header <boost/algorithm/string_regex.hpp></a></span></dt> | 
|---|
| 102 | <dt><span class="section"><a href="string_algo/reference.html#header.boost.algorithm.string.trim.hpp">Header <boost/algorithm/string/trim.hpp></a></span></dt> | 
|---|
| 103 | </dl></dd> | 
|---|
| 104 | <dt><span class="section"><a href="string_algo/rationale.html">Rationale</a></span></dt> | 
|---|
| 105 | <dd><dl> | 
|---|
| 106 | <dt><span class="section"><a href="string_algo/rationale.html#id1709513">Locales</a></span></dt> | 
|---|
| 107 | <dt><span class="section"><a href="string_algo/rationale.html#string_algo.regex">Regular Expressions</a></span></dt> | 
|---|
| 108 | </dl></dd> | 
|---|
| 109 | <dt><span class="section"><a href="string_algo/env.html">Environment</a></span></dt> | 
|---|
| 110 | <dd><dl> | 
|---|
| 111 | <dt><span class="section"><a href="string_algo/env.html#id1709621">Build</a></span></dt> | 
|---|
| 112 | <dt><span class="section"><a href="string_algo/env.html#id1709648">Examples</a></span></dt> | 
|---|
| 113 | <dt><span class="section"><a href="string_algo/env.html#id1709664">Tests</a></span></dt> | 
|---|
| 114 | <dt><span class="section"><a href="string_algo/env.html#id1709679">Portability</a></span></dt> | 
|---|
| 115 | </dl></dd> | 
|---|
| 116 | <dt><span class="section"><a href="string_algo/credits.html">Credits</a></span></dt> | 
|---|
| 117 | <dd><dl><dt><span class="section"><a href="string_algo/credits.html#string_algo.ack">Acknowledgments</a></span></dt></dl></dd> | 
|---|
| 118 | </dl> | 
|---|
| 119 | </div> | 
|---|
| 120 | <div class="section" lang="en"> | 
|---|
| 121 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> | 
|---|
| 122 | <a name="string_algo.intro"></a>Introduction</h2></div></div></div> | 
|---|
| 123 | <p> | 
|---|
| 124 |         The String Algorithm Library provides a generic implementation of | 
|---|
| 125 |         string-related algorithms which are missing in STL. It is an extension | 
|---|
| 126 |         to the algorithms library of STL and it includes trimming, case conversion,  | 
|---|
| 127 |         predicates and find/replace functions. All of them come in different variants  | 
|---|
| 128 |         so it is easier to choose the best fit for a particular need. | 
|---|
| 129 |     </p> | 
|---|
| 130 | <p> | 
|---|
| 131 |         The implementation is not restricted to work with a particular container  | 
|---|
| 132 |         (like <code class="computeroutput">std::basic_string</code>), rather it is as generic as | 
|---|
| 133 |         possible. This generalization is not compromising the performance since | 
|---|
| 134 |         algorithms are using container specific features when it means a performance | 
|---|
| 135 |         gain. | 
|---|
| 136 |     </p> | 
|---|
| 137 | <p> | 
|---|
| 138 |         <span class="bold"><strong> | 
|---|
| 139 |             Important note: In this documentation we use term <span class="emphasis"><em>string</em></span> to  | 
|---|
| 140 |             designate a sequence of <span class="emphasis"><em>characters</em></span> stored in an arbitrary container. | 
|---|
| 141 |             A <span class="emphasis"><em>string</em></span> is not restricted to <code class="computeroutput">std::basic_string</code> and  | 
|---|
| 142 |             <span class="emphasis"><em>character</em></span> does not have to be <code class="computeroutput">char</code> or <code class="computeroutput">wchar_t</code>, | 
|---|
| 143 |             although these are most common candidates. | 
|---|
| 144 |         </strong></span> | 
|---|
| 145 |         Consult the <a href="string_algo/design.html" title="Design Topics">design chapter</a> to see precise specification of | 
|---|
| 146 |         supported string types. | 
|---|
| 147 |     </p> | 
|---|
| 148 | <p>       | 
|---|
| 149 |         The library interface functions and classes are defined in namespace <code class="computeroutput">boost::algorithm</code>, and | 
|---|
| 150 |         they are lifted into namespace <code class="computeroutput">boost</code> via using declaration. | 
|---|
| 151 |     </p> | 
|---|
| 152 | <p> | 
|---|
| 153 |         The documentation is divided into several sections. For a quick start read the  | 
|---|
| 154 |         <a href="string_algo/usage.html" title="Usage">Usage</a> section followed by  | 
|---|
| 155 |         <a href="string_algo/quickref.html" title="Quick Reference">Quick Reference</a>.  | 
|---|
| 156 |         <a href="string_algo/design.html" title="Design Topics">The Design Topics</a>, | 
|---|
| 157 |         <a href="string_algo/concept.html" title="Concepts">Concepts</a> and <a href="string_algo/rationale.html" title="Rationale">Rationale</a> | 
|---|
| 158 |         provide some explanation about the library design and structure an explain how it should be used. | 
|---|
| 159 |         See the <a href="string_algo/reference.html" title="Reference">Reference</a> for the complete list of provided utilities | 
|---|
| 160 |         and algorithms. Functions and classes in the reference are organized by the headers in which they are defined. | 
|---|
| 161 |         The reference contains links to the detailed description for every entity in the library. | 
|---|
| 162 |     </p> | 
|---|
| 163 | </div> | 
|---|
| 164 | </div> | 
|---|
| 165 | <table width="100%"><tr> | 
|---|
| 166 | <td align="left"><small><p>Last revised: August 16, 2006 at 07:10:48 GMT</p></small></td> | 
|---|
| 167 | <td align="right"><small></small></td> | 
|---|
| 168 | </tr></table> | 
|---|
| 169 | <hr> | 
|---|
| 170 | <div class="spirit-nav"> | 
|---|
| 171 | <a accesskey="p" href="boost_staticassert/test.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="string_algo/release_notes.html"><img src="images/next.png" alt="Next"></a> | 
|---|
| 172 | </div> | 
|---|
| 173 | </body> | 
|---|
| 174 | </html> | 
|---|