mirror of
https://github.com/boostorg/compose.git
synced 2026-01-19 16:12:16 +00:00
55 lines
3.0 KiB
HTML
55 lines
3.0 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>compose3.cpp</TITLE>
|
|
</HEAD>
|
|
|
|
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
|
|
|
|
<TABLE HEIGHT=40 WIDTH="100%">
|
|
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
|
|
<FONT face="Arial,Helvetica" size=+2><B>
|
|
compose3.cpp
|
|
</B></FONT>
|
|
</TD></TR></TABLE><BR>
|
|
|
|
<FONT face="Arial,Helvetica"><B>
|
|
The following code example is taken from the book<BR>
|
|
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
|
|
The C++ Standard Library - A Tutorial and Reference</A><BR>
|
|
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
|
|
<A HREF="http://www.josuttis.com/libbook/copyright.html">
|
|
© Copyright</A> Nicolai M. Josuttis 1999<BR>
|
|
</B></FONT>
|
|
|
|
<BR><BR><TT>
|
|
#include <iostream><BR>
|
|
#include <algorithm><BR>
|
|
#include <functional><BR>
|
|
#include <string><BR>
|
|
#include <cctype><BR>
|
|
#include "<A href="compose.hpp.html">compose.hpp</A>"<BR>
|
|
using namespace std;<BR>
|
|
using namespace boost;<BR>
|
|
<BR>
|
|
int main()<BR>
|
|
{<BR>
|
|
string s("Internationalization");<BR>
|
|
string sub("Nation");<BR>
|
|
<BR>
|
|
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>// search substring case insensitive</I></FONT><BR>
|
|
string::iterator pos;<BR>
|
|
pos = search (s.begin(),s.end(), <I><FONT face="Arial,Helvetica" color="0000FF" size=-1>// string to search in</I></FONT><BR>
|
|
sub.begin(),sub.end(), <I><FONT face="Arial,Helvetica" color="0000FF" size=-1>// substring to search</I></FONT><BR>
|
|
compose_f_gx_hy(equal_to<int>(), <I><FONT face="Arial,Helvetica" color="0000FF" size=-1>// compar. criterion</I></FONT><BR>
|
|
ptr_fun(::toupper),<BR>
|
|
ptr_fun(::toupper)));<BR>
|
|
<BR>
|
|
if (pos != s.end()) {<BR>
|
|
cout << "\"" << sub << "\" is part of \"" << s << "\""<BR>
|
|
<< endl;<BR>
|
|
}<BR>
|
|
}<BR>
|
|
</TT>
|
|
</BODY>
|
|
</HTML>
|