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 - <boost/python/str.hpp></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 <boost/python/str.hpp></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> |
---|
86 | namespace 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 <class T> |
---|
99 | explicit str(T const& other); |
---|
100 | |
---|
101 | str capitalize() const; |
---|
102 | |
---|
103 | template <class T> |
---|
104 | str center(T const& width) const; |
---|
105 | |
---|
106 | template<class T> |
---|
107 | long count(T const& sub) const; |
---|
108 | template<class T1, class T2> |
---|
109 | long count(T1 const& sub,T2 const& start) const; |
---|
110 | template<class T1, class T2, class T3> |
---|
111 | long count(T1 const& sub,T2 const& start, T3 const& end) const; |
---|
112 | |
---|
113 | object decode() const; |
---|
114 | template<class T> |
---|
115 | object decode(T const& encoding) const; |
---|
116 | template<class T1, class T2> |
---|
117 | object decode(T1 const& encoding, T2 const& errors) const; |
---|
118 | |
---|
119 | object encode() const; |
---|
120 | template <class T> |
---|
121 | object encode(T const& encoding) const; |
---|
122 | template <class T1, class T2> |
---|
123 | object encode(T1 const& encoding, T2 const& errors) const; |
---|
124 | |
---|
125 | template <class T> |
---|
126 | bool endswith(T const& suffix) const; |
---|
127 | template <class T1, class T2> |
---|
128 | bool endswith(T1 const& suffix, T2 const& start) const; |
---|
129 | template <class T1, class T2, class T3> |
---|
130 | bool endswith(T1 const& suffix, T2 const& start, T3 const& end) const; |
---|
131 | |
---|
132 | str expandtabs() const; |
---|
133 | template <class T> |
---|
134 | str expandtabs(T const& tabsize) const; |
---|
135 | |
---|
136 | template <class T> |
---|
137 | long find(T const& sub) const; |
---|
138 | template <class T1, class T2> |
---|
139 | long find(T1 const& sub, T2 const& start) const; |
---|
140 | template <class T1, class T2, class T3> |
---|
141 | long find(T1 const& sub, T2 const& start, T3 const& end) const; |
---|
142 | |
---|
143 | template <class T> |
---|
144 | long index(T const& sub) const; |
---|
145 | template <class T1, class T2> |
---|
146 | long index(T1 const& sub, T2 const& start) const; |
---|
147 | template <class T1, class T2, class T3> |
---|
148 | long index(T1 const& sub, T2 const& start, T3 const& 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 <class T> |
---|
159 | str join(T const& sequence) const; |
---|
160 | |
---|
161 | template <class T> |
---|
162 | str ljust(T const& width) const; |
---|
163 | |
---|
164 | str lower() const; |
---|
165 | str lstrip() const; |
---|
166 | |
---|
167 | template <class T1, class T2> |
---|
168 | str replace(T1 const& old, T2 const& new_) const; |
---|
169 | template <class T1, class T2, class T3> |
---|
170 | str replace(T1 const& old, T2 const& new_, T3 const& maxsplit) const; |
---|
171 | |
---|
172 | template <class T> |
---|
173 | long rfind(T const& sub) const; |
---|
174 | template <class T1, class T2> |
---|
175 | long rfind(T1 const& sub, T2 const& start) const; |
---|
176 | template <class T1, class T2, class T3> |
---|
177 | long rfind(T1 const& sub, T2 const& start, T3 const& end) const; |
---|
178 | |
---|
179 | template <class T> |
---|
180 | long rindex(T const& sub) const; |
---|
181 | template <class T1, class T2> |
---|
182 | long rindex(T1 const& sub, T2 const& start) const; |
---|
183 | template <class T1, class T2, class T3> |
---|
184 | long rindex(T1 const& sub, T2 const& start, T3 const& end) const; |
---|
185 | |
---|
186 | template <class T> |
---|
187 | str rjust(T const& width) const; |
---|
188 | |
---|
189 | str rstrip() const; |
---|
190 | |
---|
191 | list split() const; |
---|
192 | template <class T> |
---|
193 | list split(T const& sep) const; |
---|
194 | template <class T1, class T2> |
---|
195 | list split(T1 const& sep, T2 const& maxsplit) const; |
---|
196 | |
---|
197 | list splitlines() const; |
---|
198 | template <class T> |
---|
199 | list splitlines(T const& keepends) const; |
---|
200 | |
---|
201 | template <class T> |
---|
202 | bool startswith(T const& prefix) const; |
---|
203 | template <class T1, class T2> |
---|
204 | bool startswidth(T1 const& prefix, T2 const& start) const; |
---|
205 | template <class T1, class T2, class T3> |
---|
206 | bool startswidth(T1 const& prefix, T2 const& start, T3 const& end) const; |
---|
207 | |
---|
208 | str strip() const; |
---|
209 | str swapcase() const; |
---|
210 | str title() const; |
---|
211 | |
---|
212 | template <class T> |
---|
213 | str translate(T const& table) const; |
---|
214 | template <class T1, class T2> |
---|
215 | str translate(T1 const& table, T2 const& deletechars) const; |
---|
216 | |
---|
217 | str upper() const; |
---|
218 | }; |
---|
219 | }} |
---|
220 | </pre> |
---|
221 | |
---|
222 | <h2><a name="examples"></a>Example</h2> |
---|
223 | <pre> |
---|
224 | using namespace boost::python; |
---|
225 | str remove_angle_brackets(str x) |
---|
226 | { |
---|
227 | return x.strip('<').strip('>'); |
---|
228 | } |
---|
229 | </pre> |
---|
230 | |
---|
231 | <p>Revised 3 October, 2002</p> |
---|
232 | |
---|
233 | <p><i>© Copyright <a href= |
---|
234 | "../../../../people/dave_abrahams.htm">Dave Abrahams</a> 2002.</i></p> |
---|
235 | </body> |
---|
236 | </html> |
---|
237 | |
---|