Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/doc/v2/str.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 7.6 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
4<!-- Software License, Version 1.0. (See accompanying -->
5<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
6<html>
7  <head>
8    <meta name="generator" content=
9    "HTML Tidy for Windows (vers 1st August 2002), see www.w3.org">
10    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
11    <link rel="stylesheet" type="text/css" href="../boost.css">
12
13    <title>Boost.Python - &lt;boost/python/str.hpp&gt;</title>
14  </head>
15
16  <body>
17    <table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
18    "header">
19      <tr>
20        <td valign="top" width="300">
21          <h3><a href="../../../../index.htm"><img height="86" width="277"
22          alt="C++ Boost" src="../../../../boost.png" border="0"></a></h3>
23        </td>
24
25        <td valign="top">
26          <h1 align="center"><a href="../index.html">Boost.Python</a></h1>
27
28          <h2 align="center">Header &lt;boost/python/str.hpp&gt;</h2>
29        </td>
30      </tr>
31    </table>
32    <hr>
33
34    <h2>Contents</h2>
35
36    <dl class="page-index">
37      <dt><a href="#introduction">Introduction</a></dt>
38
39      <dt><a href="#classes">Classes</a></dt>
40
41      <dd>
42        <dl class="page-index">
43          <dt><a href="#str-spec">Class <code>str</code></a></dt>
44
45          <dd>
46            <dl class="page-index">
47              <dt><a href="#str-spec-synopsis">Class <code>str</code>
48              synopsis</a></dt>
49            </dl>
50          </dd>
51        </dl>
52      </dd>
53
54      <dt><a href="#examples">Example(s)</a></dt>
55    </dl>
56    <hr>
57
58    <h2><a name="introduction"></a>Introduction</h2>
59
60    <p>Exposes a <a href=
61    "ObjectWrapper.html#TypeWrapper-concept">TypeWrapper</a> for the Python
62    <a href=
63    "http://www.python.org/dev/doc/devel/lib/string-methods.html">str</a>
64    type.</p>
65
66    <h2><a name="classes"></a>Classes</h2>
67
68    <h3><a name="str-spec"></a>Class <code>str</code></h3>
69
70    <p>Exposes the <a href=
71    "http://www.python.org/dev/doc/devel/lib/string-methods.html">string
72    methods</a> of Python's built-in <code>str</code> type. The
73    semantics of the constructors and member functions defined below,
74    except for the two-argument constructors which construct str
75    objects from a range of characters, can be fully understood by
76    reading the <a href=
77    "ObjectWrapper.html#TypeWrapper-concept">TypeWrapper</a> concept
78    definition. Since <code>str</code> is publicly derived from
79    <code><a href="object.html#object-spec">object</a></code>, the
80    public object interface applies to <code>str</code> instances as
81    well.</p>
82
83    <h4><a name="str-spec-synopsis"></a>Class <code>str</code>
84    synopsis</h4>
85<pre>
86namespace boost { namespace python
87{
88  class str : public object
89  {
90   public:
91      str(); // new str
92
93      str(char const* s); // new str
94
95      str(char const* start, char const* finish); // new str
96      str(char const* start, std::size_t length); // new str
97
98      template &lt;class T&gt;
99      explicit str(T const&amp; other);
100
101      str capitalize() const;
102
103      template &lt;class T&gt;
104      str center(T const&amp; width) const;
105
106      template&lt;class T&gt;
107      long count(T const&amp; sub) const;
108      template&lt;class T1, class T2&gt;
109      long count(T1 const&amp; sub,T2 const&amp; start) const;
110      template&lt;class T1, class T2, class T3&gt;
111      long count(T1 const&amp; sub,T2 const&amp; start, T3 const&amp; end) const;
112
113      object decode() const;
114      template&lt;class T&gt;
115      object decode(T const&amp; encoding) const;
116      template&lt;class T1, class T2&gt;
117      object decode(T1 const&amp; encoding, T2 const&amp; errors) const;
118
119      object encode() const;
120      template &lt;class T&gt;
121      object encode(T const&amp; encoding) const;
122      template &lt;class T1, class T2&gt;
123      object encode(T1 const&amp; encoding, T2 const&amp; errors) const;
124
125      template &lt;class T&gt;
126      bool endswith(T const&amp; suffix) const;
127      template &lt;class T1, class T2&gt;
128      bool endswith(T1 const&amp; suffix, T2 const&amp; start) const;
129      template &lt;class T1, class T2, class T3&gt;
130      bool endswith(T1 const&amp; suffix, T2 const&amp; start, T3 const&amp; end) const;
131
132      str expandtabs() const;
133      template &lt;class T&gt;
134      str expandtabs(T const&amp; tabsize) const;
135
136      template &lt;class T&gt;
137      long find(T const&amp; sub) const;
138      template &lt;class T1, class T2&gt;
139      long find(T1 const&amp; sub, T2 const&amp; start) const;
140      template &lt;class T1, class T2, class T3&gt;
141      long find(T1 const&amp; sub, T2 const&amp; start, T3 const&amp; end) const;
142
143      template &lt;class T&gt;
144      long index(T const&amp; sub) const;
145      template &lt;class T1, class T2&gt;
146      long index(T1 const&amp; sub, T2 const&amp; start) const;
147      template &lt;class T1, class T2, class T3&gt;
148      long index(T1 const&amp; sub, T2 const&amp; start, T3 const&amp; end) const;
149
150      bool isalnum() const;
151      bool isalpha() const;
152      bool isdigit() const;
153      bool islower() const;
154      bool isspace() const;
155      bool istitle() const;
156      bool isupper() const;
157
158      template &lt;class T&gt;
159      str join(T const&amp; sequence) const;
160
161      template &lt;class T&gt;
162      str ljust(T const&amp; width) const;
163
164      str lower() const;
165      str lstrip() const;
166
167      template &lt;class T1, class T2&gt;
168      str replace(T1 const&amp; old, T2 const&amp; new_) const;
169      template &lt;class T1, class T2, class T3&gt;
170      str replace(T1 const&amp; old, T2 const&amp; new_, T3 const&amp; maxsplit) const;
171
172      template &lt;class T&gt;
173      long rfind(T const&amp; sub) const;
174      template &lt;class T1, class T2&gt;
175      long rfind(T1 const&amp; sub, T2 const&amp; start) const;
176      template &lt;class T1, class T2, class T3&gt;
177      long rfind(T1 const&amp; sub, T2 const&amp; start, T3 const&amp; end) const;
178
179      template &lt;class T&gt;
180      long rindex(T const&amp; sub) const;
181      template &lt;class T1, class T2&gt;
182      long rindex(T1 const&amp; sub, T2 const&amp; start) const;
183      template &lt;class T1, class T2, class T3&gt;
184      long rindex(T1 const&amp; sub, T2 const&amp; start, T3 const&amp; end) const;
185
186      template &lt;class T&gt;
187      str rjust(T const&amp; width) const;
188
189      str rstrip() const;
190
191      list split() const;
192      template &lt;class T&gt;
193      list split(T const&amp; sep) const;
194      template &lt;class T1, class T2&gt;
195      list split(T1 const&amp; sep, T2 const&amp; maxsplit) const;
196
197      list splitlines() const;
198      template &lt;class T&gt;
199      list splitlines(T const&amp; keepends) const;
200
201      template &lt;class T&gt;
202      bool startswith(T const&amp; prefix) const;
203      template &lt;class T1, class T2&gt;
204      bool startswidth(T1 const&amp; prefix, T2 const&amp; start) const;
205      template &lt;class T1, class T2, class T3&gt;
206      bool startswidth(T1 const&amp; prefix, T2 const&amp; start, T3 const&amp; end) const;
207
208      str strip() const;
209      str swapcase() const;
210      str title() const;
211
212      template &lt;class T&gt;
213      str translate(T const&amp; table) const;
214      template &lt;class T1, class T2&gt;
215      str translate(T1 const&amp; table, T2 const&amp; deletechars) const;
216
217      str upper() const;
218  };
219}}
220</pre>
221
222    <h2><a name="examples"></a>Example</h2>
223<pre>
224using namespace boost::python;
225str remove_angle_brackets(str x)
226{
227  return x.strip('&lt;').strip('&gt;');
228}
229</pre>
230
231    <p>Revised 3 October, 2002</p>
232
233    <p><i>&copy; Copyright <a href=
234    "../../../../people/dave_abrahams.htm">Dave Abrahams</a> 2002.</i></p>
235  </body>
236</html>
237
Note: See TracBrowser for help on using the repository browser.