diff options
Diffstat (limited to 'doc/html/string_algo/usage.html')
-rw-r--r--[-rwxr-xr-x] | doc/html/string_algo/usage.html | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/doc/html/string_algo/usage.html b/doc/html/string_algo/usage.html index e9588ca24e..d32b00cce4 100755..100644 --- a/doc/html/string_algo/usage.html +++ b/doc/html/string_algo/usage.html @@ -26,18 +26,18 @@ <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="string_algo.usage"></a>Usage</h2></div></div></div> <div class="toc"><dl> -<dt><span class="section"><a href="usage.html#id3183270">First Example</a></span></dt> -<dt><span class="section"><a href="usage.html#id3183468">Case conversion</a></span></dt> -<dt><span class="section"><a href="usage.html#id3183534">Predicates and Classification</a></span></dt> -<dt><span class="section"><a href="usage.html#id3183616">Trimming</a></span></dt> -<dt><span class="section"><a href="usage.html#id3183685">Find algorithms</a></span></dt> -<dt><span class="section"><a href="usage.html#id3183806">Replace Algorithms</a></span></dt> -<dt><span class="section"><a href="usage.html#id3183933">Find Iterator</a></span></dt> -<dt><span class="section"><a href="usage.html#id3184031">Split</a></span></dt> +<dt><span class="section"><a href="usage.html#id3239405">First Example</a></span></dt> +<dt><span class="section"><a href="usage.html#id3239602">Case conversion</a></span></dt> +<dt><span class="section"><a href="usage.html#id3239668">Predicates and Classification</a></span></dt> +<dt><span class="section"><a href="usage.html#id3239757">Trimming</a></span></dt> +<dt><span class="section"><a href="usage.html#id3239826">Find algorithms</a></span></dt> +<dt><span class="section"><a href="usage.html#id3239948">Replace Algorithms</a></span></dt> +<dt><span class="section"><a href="usage.html#id3240076">Find Iterator</a></span></dt> +<dt><span class="section"><a href="usage.html#id3240174">Split</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183270"></a>First Example</h3></div></div></div> +<a name="id3239405"></a>First Example</h3></div></div></div> <p> Using the algorithms is straightforward. Let us have a look at the first example: </p> @@ -109,7 +109,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183468"></a>Case conversion</h3></div></div></div> +<a name="id3239602"></a>Case conversion</h3></div></div></div> <p> STL has a nice way of converting character case. Unfortunately, it works only for a single character and we want to convert a string, @@ -128,7 +128,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183534"></a>Predicates and Classification</h3></div></div></div> +<a name="id3239668"></a>Predicates and Classification</h3></div></div></div> <p> A part of the library deals with string related predicates. Consider this example: </p> @@ -149,12 +149,12 @@ << endl; // prints "command.com is an executable" //.. - char text1[]="hello world!"; + char text1[]="hello"; cout << text1 - << (all( text1, is_lower() )? "is": "is not") + << (all( text1, is_lower() )? " is": " is not") << " written in the lower case" - << endl; // prints "hello world! is written in the lower case" + << endl; // prints "hello is written in the lower case" </pre> <p> The predicates determine whether if a substring is contained in the input string @@ -164,6 +164,11 @@ <code class="computeroutput"><a class="link" href="reference.html#header.boost.algorithm.string.predicate_hpp" title="Header <boost/algorithm/string/predicate.hpp>">boost/algorithm/string/predicate.hpp</a></code> for more details. </p> <p> + Note that if we had used "hello world" as the input to the test, it would have + output "hello world is not written in the lower case" because the space in the + input string is not a lower case letter. + </p> +<p> In addition the algorithm <code class="computeroutput"><a class="link" href="../boost/algorithm/all.html" title="Function template all">all()</a></code> checks all elements of a container to satisfy a condition specified by a predicate. This predicate can be any unary predicate, but the library provides a bunch of @@ -175,9 +180,9 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183616"></a>Trimming</h3></div></div></div> +<a name="id3239757"></a>Trimming</h3></div></div></div> <p> - When parsing the input from a user, strings usually have unwanted leading or trailing + When parsing the input from a user, strings often have unwanted leading or trailing characters. To get rid of them, we need trim functions: </p> <pre class="programlisting"> @@ -201,7 +206,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183685"></a>Find algorithms</h3></div></div></div> +<a name="id3239826"></a>Find algorithms</h3></div></div></div> <p> The library contains a set of find algorithms. Here is an example: </p> @@ -241,7 +246,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183806"></a>Replace Algorithms</h3></div></div></div> +<a name="id3239948"></a>Replace Algorithms</h3></div></div></div> <p> Find algorithms can be used for searching for a specific part of string. Replace goes one step further. After a matching part is found, it is substituted with something else. The substitution is computed @@ -273,7 +278,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3183933"></a>Find Iterator</h3></div></div></div> +<a name="id3240076"></a>Find Iterator</h3></div></div></div> <p> An extension to find algorithms it the Find Iterator. Instead of searching for just a one part of a string, the find iterator allows us to iterate over the substrings matching the specified criteria. @@ -331,7 +336,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3184031"></a>Split</h3></div></div></div> +<a name="id3240174"></a>Split</h3></div></div></div> <p> Split algorithms are an extension to the find iterator for one common usage scenario. These algorithms use a find iterator and store all matches into the provided @@ -340,7 +345,7 @@ </p> <p> Two algorithms are provided. <code class="computeroutput"><a class="link" href="../boost/algorithm/find_all.html" title="Function template find_all">find_all()</a></code> finds all copies - of a string in the input. <code class="computeroutput"><a class="link" href="../boost/algorithm/split_id820181.html" title="Function template split">split()</a></code> splits the input into parts. + of a string in the input. <code class="computeroutput"><a class="link" href="../boost/algorithm/split_id819641.html" title="Function template split">split()</a></code> splits the input into parts. </p> <pre class="programlisting"> string str1("hello abc-*-ABC-*-aBc goodbye"); @@ -364,7 +369,7 @@ to all substrings that are in case-insensitive manner equal to "abc". </p> <p> - Second example uses <code class="computeroutput"><a class="link" href="../boost/algorithm/split_id820181.html" title="Function template split">split()</a></code> to split string str1 into parts + Second example uses <code class="computeroutput"><a class="link" href="../boost/algorithm/split_id819641.html" title="Function template split">split()</a></code> to split string str1 into parts separated by characters '-' or '*'. These parts are then put into the SplitVec. It is possible to specify if adjacent separators are concatenated or not. </p> @@ -374,7 +379,7 @@ </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> -<td align="left"><p><small>Last revised: October 30, 2010 at 18:34:45 +0100</small></p></td> +<td align="left"><p><small>Last revised: July 27, 2012 at 19:15:55 +0100</small></p></td> <td align="right"><div class="copyright-footer">Copyright © 2002-2004 Pavol Droba<p>Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file <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>) |