source: trunk/doc/html/qstring.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 144.8 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qstring.cpp:1228 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QString Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QString Class Reference</h1>
33
34<p>The QString class provides an abstraction of Unicode text
35and the classic C '&#92;0'-terminated char array.
36<a href="#details">More...</a>
37<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
38<p><tt>#include &lt;<a href="qstring-h.html">qstring.h</a>&gt;</tt>
39<p><a href="qstring-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#QString"><b>QString</b></a> ()</li>
43<li class=fn><a href="#QString-2"><b>QString</b></a> ( QChar&nbsp;ch )</li>
44<li class=fn><a href="#QString-3"><b>QString</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
45<li class=fn><a href="#QString-4"><b>QString</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;ba )</li>
46<li class=fn><a href="#QString-5"><b>QString</b></a> ( const&nbsp;QChar&nbsp;*&nbsp;unicode, uint&nbsp;length )</li>
47<li class=fn><a href="#QString-6"><b>QString</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
48<li class=fn><a href="#QString-7"><b>QString</b></a> ( const&nbsp;std::string&nbsp;&amp;&nbsp;str )</li>
49<li class=fn><a href="#~QString"><b>~QString</b></a> ()</li>
50<li class=fn>QString &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
51<li class=fn>QString &amp; <a href="#operator-eq-3"><b>operator=</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
52<li class=fn>QString &amp; <a href="#operator-eq-4"><b>operator=</b></a> ( const&nbsp;std::string&nbsp;&amp;&nbsp;s )</li>
53<li class=fn>QString &amp; <a href="#operator-eq-5"><b>operator=</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;cstr )</li>
54<li class=fn>QString &amp; <a href="#operator-eq"><b>operator=</b></a> ( QChar&nbsp;c )</li>
55<li class=fn>QString &amp; <a href="#operator-eq-6"><b>operator=</b></a> ( char&nbsp;c )</li>
56<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
57<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
58<li class=fn>uint <a href="#length"><b>length</b></a> () const</li>
59<li class=fn>void <a href="#truncate"><b>truncate</b></a> ( uint&nbsp;newLen )</li>
60<li class=fn>QString &amp; <a href="#fill"><b>fill</b></a> ( QChar&nbsp;c, int&nbsp;len = -1 )</li>
61<li class=fn>QString copy () const &nbsp;<em>(obsolete)</em></li>
62<li class=fn>QString <a href="#arg-2"><b>arg</b></a> ( long&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
63<li class=fn>QString <a href="#arg-3"><b>arg</b></a> ( ulong&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
64<li class=fn>QString <a href="#arg-4"><b>arg</b></a> ( Q_LLONG&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
65<li class=fn>QString <a href="#arg-5"><b>arg</b></a> ( Q_ULLONG&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
66<li class=fn>QString <a href="#arg-6"><b>arg</b></a> ( int&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
67<li class=fn>QString <a href="#arg-7"><b>arg</b></a> ( uint&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
68<li class=fn>QString <a href="#arg-8"><b>arg</b></a> ( short&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
69<li class=fn>QString <a href="#arg-9"><b>arg</b></a> ( ushort&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const</li>
70<li class=fn>QString <a href="#arg-a"><b>arg</b></a> ( double&nbsp;a, int&nbsp;fieldWidth = 0, char&nbsp;fmt = 'g', int&nbsp;prec = -1 ) const</li>
71<li class=fn>QString <a href="#arg-b"><b>arg</b></a> ( char&nbsp;a, int&nbsp;fieldWidth = 0 ) const</li>
72<li class=fn>QString <a href="#arg-c"><b>arg</b></a> ( QChar&nbsp;a, int&nbsp;fieldWidth = 0 ) const</li>
73<li class=fn>QString <a href="#arg"><b>arg</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;a, int&nbsp;fieldWidth = 0 ) const</li>
74<li class=fn>QString <a href="#arg-d"><b>arg</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;a1, const&nbsp;QString&nbsp;&amp;&nbsp;a2 ) const</li>
75<li class=fn>QString <a href="#arg-e"><b>arg</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;a1, const&nbsp;QString&nbsp;&amp;&nbsp;a2, const&nbsp;QString&nbsp;&amp;&nbsp;a3 ) const</li>
76<li class=fn>QString <a href="#arg-f"><b>arg</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;a1, const&nbsp;QString&nbsp;&amp;&nbsp;a2, const&nbsp;QString&nbsp;&amp;&nbsp;a3, const&nbsp;QString&nbsp;&amp;&nbsp;a4 ) const</li>
77<li class=fn>QString &amp; <a href="#sprintf"><b>sprintf</b></a> ( const&nbsp;char&nbsp;*&nbsp;cformat, ... )</li>
78<li class=fn>int <a href="#find-2"><b>find</b></a> ( QChar&nbsp;c, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const</li>
79<li class=fn>int <a href="#find-3"><b>find</b></a> ( char&nbsp;c, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const</li>
80<li class=fn>int <a href="#find-4"><b>find</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const</li>
81<li class=fn>int <a href="#find"><b>find</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx, int&nbsp;index = 0 ) const</li>
82<li class=fn>int <a href="#find-5"><b>find</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = 0 ) const</li>
83<li class=fn>int <a href="#findRev-2"><b>findRev</b></a> ( QChar&nbsp;c, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const</li>
84<li class=fn>int <a href="#findRev-3"><b>findRev</b></a> ( char&nbsp;c, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const</li>
85<li class=fn>int <a href="#findRev-4"><b>findRev</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const</li>
86<li class=fn>int <a href="#findRev-5"><b>findRev</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx, int&nbsp;index = -1 ) const</li>
87<li class=fn>int <a href="#findRev"><b>findRev</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = -1 ) const</li>
88<li class=fn>int <a href="#contains"><b>contains</b></a> ( QChar&nbsp;c, bool&nbsp;cs = TRUE ) const</li>
89<li class=fn>int <a href="#contains-2"><b>contains</b></a> ( char&nbsp;c, bool&nbsp;cs = TRUE ) const</li>
90<li class=fn>int <a href="#contains-3"><b>contains</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, bool&nbsp;cs = TRUE ) const</li>
91<li class=fn>int <a href="#contains-4"><b>contains</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str, bool&nbsp;cs = TRUE ) const</li>
92<li class=fn>int <a href="#contains-5"><b>contains</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx ) const</li>
93<li class=fn>enum <a href="#SectionFlags-enum"><b>SectionFlags</b></a> { SectionDefault = 0x00, SectionSkipEmpty = 0x01, SectionIncludeLeadingSep = 0x02, SectionIncludeTrailingSep = 0x04, SectionCaseInsensitiveSeps = 0x08 }</li>
94<li class=fn>QString <a href="#section"><b>section</b></a> ( QChar&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const</li>
95<li class=fn>QString <a href="#section-2"><b>section</b></a> ( char&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const</li>
96<li class=fn>QString <a href="#section-3"><b>section</b></a> ( const&nbsp;char&nbsp;*&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const</li>
97<li class=fn>QString <a href="#section-4"><b>section</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const</li>
98<li class=fn>QString <a href="#section-5"><b>section</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;reg, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const</li>
99<li class=fn>QString <a href="#left"><b>left</b></a> ( uint&nbsp;len ) const</li>
100<li class=fn>QString <a href="#right"><b>right</b></a> ( uint&nbsp;len ) const</li>
101<li class=fn>QString <a href="#mid"><b>mid</b></a> ( uint&nbsp;index, uint&nbsp;len = 0xffffffff ) const</li>
102<li class=fn>QString <a href="#leftJustify"><b>leftJustify</b></a> ( uint&nbsp;width, QChar&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const</li>
103<li class=fn>QString <a href="#rightJustify"><b>rightJustify</b></a> ( uint&nbsp;width, QChar&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const</li>
104<li class=fn>QString <a href="#lower"><b>lower</b></a> () const</li>
105<li class=fn>QString <a href="#upper"><b>upper</b></a> () const</li>
106<li class=fn>QString <a href="#stripWhiteSpace"><b>stripWhiteSpace</b></a> () const</li>
107<li class=fn>QString <a href="#simplifyWhiteSpace"><b>simplifyWhiteSpace</b></a> () const</li>
108<li class=fn>QString &amp; <a href="#insert"><b>insert</b></a> ( uint&nbsp;index, const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
109<li class=fn>QString &amp; <a href="#insert-2"><b>insert</b></a> ( uint&nbsp;index, const&nbsp;QByteArray&nbsp;&amp;&nbsp;s )</li>
110<li class=fn>QString &amp; <a href="#insert-3"><b>insert</b></a> ( uint&nbsp;index, const&nbsp;char&nbsp;*&nbsp;s )</li>
111<li class=fn>QString &amp; <a href="#insert-4"><b>insert</b></a> ( uint&nbsp;index, const&nbsp;QChar&nbsp;*&nbsp;s, uint&nbsp;len )</li>
112<li class=fn>QString &amp; <a href="#insert-5"><b>insert</b></a> ( uint&nbsp;index, QChar&nbsp;c )</li>
113<li class=fn>QString &amp; <a href="#insert-6"><b>insert</b></a> ( uint&nbsp;index, char&nbsp;c )</li>
114<li class=fn>QString &amp; <a href="#append-2"><b>append</b></a> ( char&nbsp;ch )</li>
115<li class=fn>QString &amp; <a href="#append-3"><b>append</b></a> ( QChar&nbsp;ch )</li>
116<li class=fn>QString &amp; <a href="#append"><b>append</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str )</li>
117<li class=fn>QString &amp; <a href="#append-4"><b>append</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;str )</li>
118<li class=fn>QString &amp; <a href="#append-5"><b>append</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
119<li class=fn>QString &amp; <a href="#append-6"><b>append</b></a> ( const&nbsp;std::string&nbsp;&amp;&nbsp;str )</li>
120<li class=fn>QString &amp; <a href="#prepend-2"><b>prepend</b></a> ( char&nbsp;ch )</li>
121<li class=fn>QString &amp; <a href="#prepend-3"><b>prepend</b></a> ( QChar&nbsp;ch )</li>
122<li class=fn>QString &amp; <a href="#prepend"><b>prepend</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
123<li class=fn>QString &amp; <a href="#prepend-4"><b>prepend</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;s )</li>
124<li class=fn>QString &amp; <a href="#prepend-5"><b>prepend</b></a> ( const&nbsp;char&nbsp;*&nbsp;s )</li>
125<li class=fn>QString &amp; <a href="#prepend-6"><b>prepend</b></a> ( const&nbsp;std::string&nbsp;&amp;&nbsp;s )</li>
126<li class=fn>QString &amp; <a href="#remove"><b>remove</b></a> ( uint&nbsp;index, uint&nbsp;len )</li>
127<li class=fn>QString &amp; <a href="#remove-2"><b>remove</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str, bool&nbsp;cs = TRUE )</li>
128<li class=fn>QString &amp; <a href="#remove-3"><b>remove</b></a> ( QChar&nbsp;c )</li>
129<li class=fn>QString &amp; <a href="#remove-4"><b>remove</b></a> ( char&nbsp;c )</li>
130<li class=fn>QString &amp; <a href="#remove-5"><b>remove</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
131<li class=fn>QString &amp; <a href="#remove-6"><b>remove</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx )</li>
132<li class=fn>QString &amp; <a href="#replace"><b>replace</b></a> ( uint&nbsp;index, uint&nbsp;len, const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
133<li class=fn>QString &amp; <a href="#replace-2"><b>replace</b></a> ( uint&nbsp;index, uint&nbsp;len, const&nbsp;QChar&nbsp;*&nbsp;s, uint&nbsp;slen )</li>
134<li class=fn>QString &amp; <a href="#replace-3"><b>replace</b></a> ( uint&nbsp;index, uint&nbsp;len, QChar&nbsp;c )</li>
135<li class=fn>QString &amp; <a href="#replace-4"><b>replace</b></a> ( uint&nbsp;index, uint&nbsp;len, char&nbsp;c )</li>
136<li class=fn>QString &amp; <a href="#replace-5"><b>replace</b></a> ( QChar&nbsp;c, const&nbsp;QString&nbsp;&amp;&nbsp;after, bool&nbsp;cs = TRUE )</li>
137<li class=fn>QString &amp; <a href="#replace-6"><b>replace</b></a> ( char&nbsp;c, const&nbsp;QString&nbsp;&amp;&nbsp;after, bool&nbsp;cs = TRUE )</li>
138<li class=fn>QString &amp; <a href="#replace-7"><b>replace</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;before, const&nbsp;QString&nbsp;&amp;&nbsp;after, bool&nbsp;cs = TRUE )</li>
139<li class=fn>QString &amp; <a href="#replace-8"><b>replace</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx, const&nbsp;QString&nbsp;&amp;&nbsp;after )</li>
140<li class=fn>QString &amp; <a href="#replace-9"><b>replace</b></a> ( QChar&nbsp;c1, QChar&nbsp;c2 )</li>
141<li class=fn>short <a href="#toShort"><b>toShort</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
142<li class=fn>ushort <a href="#toUShort"><b>toUShort</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
143<li class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
144<li class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
145<li class=fn>long <a href="#toLong"><b>toLong</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
146<li class=fn>ulong <a href="#toULong"><b>toULong</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
147<li class=fn>Q_LLONG <a href="#toLongLong"><b>toLongLong</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
148<li class=fn>Q_ULLONG <a href="#toULongLong"><b>toULongLong</b></a> ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const</li>
149<li class=fn>float <a href="#toFloat"><b>toFloat</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
150<li class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
151<li class=fn>QString &amp; <a href="#setNum-2"><b>setNum</b></a> ( short&nbsp;n, int&nbsp;base = 10 )</li>
152<li class=fn>QString &amp; <a href="#setNum-3"><b>setNum</b></a> ( ushort&nbsp;n, int&nbsp;base = 10 )</li>
153<li class=fn>QString &amp; <a href="#setNum-4"><b>setNum</b></a> ( int&nbsp;n, int&nbsp;base = 10 )</li>
154<li class=fn>QString &amp; <a href="#setNum-5"><b>setNum</b></a> ( uint&nbsp;n, int&nbsp;base = 10 )</li>
155<li class=fn>QString &amp; <a href="#setNum-6"><b>setNum</b></a> ( long&nbsp;n, int&nbsp;base = 10 )</li>
156<li class=fn>QString &amp; <a href="#setNum-7"><b>setNum</b></a> ( ulong&nbsp;n, int&nbsp;base = 10 )</li>
157<li class=fn>QString &amp; <a href="#setNum"><b>setNum</b></a> ( Q_LLONG&nbsp;n, int&nbsp;base = 10 )</li>
158<li class=fn>QString &amp; <a href="#setNum-8"><b>setNum</b></a> ( Q_ULLONG&nbsp;n, int&nbsp;base = 10 )</li>
159<li class=fn>QString &amp; <a href="#setNum-9"><b>setNum</b></a> ( float&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )</li>
160<li class=fn>QString &amp; <a href="#setNum-a"><b>setNum</b></a> ( double&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )</li>
161<li class=fn>void setExpand ( uint&nbsp;index, QChar&nbsp;c ) &nbsp;<em>(obsolete)</em></li>
162<li class=fn>QString &amp; <a href="#operator+-eq"><b>operator+=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str )</li>
163<li class=fn>QString &amp; <a href="#operator+-eq-2"><b>operator+=</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;str )</li>
164<li class=fn>QString &amp; <a href="#operator+-eq-3"><b>operator+=</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
165<li class=fn>QString &amp; <a href="#operator+-eq-4"><b>operator+=</b></a> ( const&nbsp;std::string&nbsp;&amp;&nbsp;str )</li>
166<li class=fn>QString &amp; <a href="#operator+-eq-5"><b>operator+=</b></a> ( QChar&nbsp;c )</li>
167<li class=fn>QString &amp; <a href="#operator+-eq-6"><b>operator+=</b></a> ( char&nbsp;c )</li>
168<li class=fn>QChar <a href="#at"><b>at</b></a> ( uint&nbsp;i ) const</li>
169<li class=fn>QChar <a href="#operator[]"><b>operator[]</b></a> ( int&nbsp;i ) const</li>
170<li class=fn>QCharRef <a href="#at-2"><b>at</b></a> ( uint&nbsp;i )</li>
171<li class=fn>QCharRef <a href="#operator[]-2"><b>operator[]</b></a> ( int&nbsp;i )</li>
172<li class=fn>QChar <a href="#constref"><b>constref</b></a> ( uint&nbsp;i ) const</li>
173<li class=fn>QChar &amp; <a href="#ref"><b>ref</b></a> ( uint&nbsp;i )</li>
174<li class=fn>const QChar * <a href="#unicode"><b>unicode</b></a> () const</li>
175<li class=fn>const char * <a href="#ascii"><b>ascii</b></a> () const</li>
176<li class=fn>const char * <a href="#latin1"><b>latin1</b></a> () const</li>
177<li class=fn>QCString <a href="#utf8"><b>utf8</b></a> () const</li>
178<li class=fn>QCString <a href="#local8Bit"><b>local8Bit</b></a> () const</li>
179<li class=fn>bool <a href="#operator!"><b>operator!</b></a> () const</li>
180<li class=fn><a href="#operator-const-char-*"><b>operator const char *</b></a> () const</li>
181<li class=fn><a href="#operator-std::string"><b>operator std::string</b></a> () const</li>
182<li class=fn>const unsigned short * <a href="#ucs2"><b>ucs2</b></a> () const</li>
183<li class=fn>QString &amp; <a href="#setUnicode"><b>setUnicode</b></a> ( const&nbsp;QChar&nbsp;*&nbsp;unicode, uint&nbsp;len )</li>
184<li class=fn>QString &amp; <a href="#setUnicodeCodes"><b>setUnicodeCodes</b></a> ( const&nbsp;ushort&nbsp;*&nbsp;unicode_as_ushorts, uint&nbsp;len )</li>
185<li class=fn>QString &amp; <a href="#setAscii"><b>setAscii</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;len = -1 )</li>
186<li class=fn>QString &amp; <a href="#setLatin1"><b>setLatin1</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;len = -1 )</li>
187<li class=fn>int <a href="#compare-2"><b>compare</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s ) const</li>
188<li class=fn>int <a href="#localeAwareCompare-2"><b>localeAwareCompare</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s ) const</li>
189<li class=fn>void <a href="#compose"><b>compose</b></a> ()</li>
190<li class=fn>const char * data () const &nbsp;<em>(obsolete)</em></li>
191<li class=fn>bool <a href="#startsWith"><b>startsWith</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s, bool&nbsp;cs = TRUE ) const</li>
192<li class=fn>bool <a href="#endsWith"><b>endsWith</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s, bool&nbsp;cs = TRUE ) const</li>
193<li class=fn>void <a href="#setLength"><b>setLength</b></a> ( uint&nbsp;newLen )</li>
194<li class=fn>uint <a href="#capacity"><b>capacity</b></a> () const</li>
195<li class=fn>void <a href="#reserve"><b>reserve</b></a> ( uint&nbsp;minCapacity )</li>
196<li class=fn>void <a href="#squeeze"><b>squeeze</b></a> ()</li>
197</ul>
198<h2>Static Public Members</h2>
199<ul>
200<li class=fn>QString <a href="#number"><b>number</b></a> ( long&nbsp;n, int&nbsp;base = 10 )</li>
201<li class=fn>QString <a href="#number-2"><b>number</b></a> ( ulong&nbsp;n, int&nbsp;base = 10 )</li>
202<li class=fn>QString <a href="#number-3"><b>number</b></a> ( Q_LLONG&nbsp;n, int&nbsp;base = 10 )</li>
203<li class=fn>QString <a href="#number-4"><b>number</b></a> ( Q_ULLONG&nbsp;n, int&nbsp;base = 10 )</li>
204<li class=fn>QString <a href="#number-5"><b>number</b></a> ( int&nbsp;n, int&nbsp;base = 10 )</li>
205<li class=fn>QString <a href="#number-6"><b>number</b></a> ( uint&nbsp;n, int&nbsp;base = 10 )</li>
206<li class=fn>QString <a href="#number-7"><b>number</b></a> ( double&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )</li>
207<li class=fn>QString <a href="#fromAscii"><b>fromAscii</b></a> ( const&nbsp;char&nbsp;*&nbsp;ascii, int&nbsp;len = -1 )</li>
208<li class=fn>QString <a href="#fromLatin1"><b>fromLatin1</b></a> ( const&nbsp;char&nbsp;*&nbsp;chars, int&nbsp;len = -1 )</li>
209<li class=fn>QString <a href="#fromUtf8"><b>fromUtf8</b></a> ( const&nbsp;char&nbsp;*&nbsp;utf8, int&nbsp;len = -1 )</li>
210<li class=fn>QString <a href="#fromLocal8Bit"><b>fromLocal8Bit</b></a> ( const&nbsp;char&nbsp;*&nbsp;local8Bit, int&nbsp;len = -1 )</li>
211<li class=fn>QString <a href="#fromUcs2"><b>fromUcs2</b></a> ( const&nbsp;unsigned&nbsp;short&nbsp;*&nbsp;str )</li>
212<li class=fn>int <a href="#compare"><b>compare</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
213<li class=fn>int <a href="#localeAwareCompare"><b>localeAwareCompare</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
214</ul>
215<h2>Related Functions</h2>
216<ul>
217<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
218<li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
219<li class=fn>bool <a href="#operator-eq-eq-3"><b>operator==</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
220<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
221<li class=fn>bool <a href="#operator!-eq-2"><b>operator!=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
222<li class=fn>bool <a href="#operator!-eq-3"><b>operator!=</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
223<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
224<li class=fn>bool <a href="#operator-lt-2"><b>operator&lt;</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
225<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
226<li class=fn>bool <a href="#operator-lt-eq-2"><b>operator&lt;=</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
227<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
228<li class=fn>bool <a href="#operator-gt-2"><b>operator&gt;</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
229<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
230<li class=fn>bool <a href="#operator-gt-eq-2"><b>operator&gt;=</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
231<li class=fn>const QString <a href="#operator+"><b>operator+</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
232<li class=fn>const QString <a href="#operator+-2"><b>operator+</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
233<li class=fn>const QString <a href="#operator+-3"><b>operator+</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QString&nbsp;&amp;&nbsp;s2 )</li>
234<li class=fn>const QString <a href="#operator+-4"><b>operator+</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s, char&nbsp;c )</li>
235<li class=fn>const QString <a href="#operator+-5"><b>operator+</b></a> ( char&nbsp;c, const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
236<li class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QString&nbsp;&amp;&nbsp;str )</li>
237<li class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QString&nbsp;&amp;&nbsp;str )</li>
238</ul>
239<hr><a name="details"></a><h2>Detailed Description</h2>
240
241
242
243<p> The QString class provides an abstraction of Unicode text
244and the classic C '&#92;0'-terminated char array.
245<p>
246
247
248
249<p> QString uses <a href="shclass.html">implicit sharing</a>, which
250makes it very efficient and easy to use.
251<p> In all of the QString methods that take <tt>const char *</tt>
252parameters, the <tt>const char *</tt> is interpreted as a classic
253C-style '&#92;0'-terminated ASCII string. It is legal for the <tt>const char *</tt> parameter to be 0. If the <tt>const char *</tt> is not
254'&#92;0'-terminated, the results are undefined. Functions that copy
255classic C strings into a QString will not copy the terminating
256'&#92;0' character. The <a href="qchar.html">QChar</a> array of the QString (as returned by
257<a href="#unicode">unicode</a>()) is generally not terminated by a '&#92;0'. If you need to
258pass a QString to a function that requires a C '&#92;0'-terminated
259string use <a href="#latin1">latin1</a>().
260<p> <!-- index QString::null --><a name="QString-null"></a>A QString that has not been assigned to anything is <em>null</em>, i.e.
261both the length and data pointer is 0. A QString that references
262the empty string ("", a single '&#92;0' char) is <em>empty</em>. Both null
263and empty QStrings are legal parameters to the methods. Assigning
264<tt>(const char *) 0</tt> to QString gives a null QString. For
265convenience, <a href="qstring.html#QString-null">QString::null</a> is a null QString. When sorting,
266empty strings come first, followed by non-empty strings, followed
267by null strings. We recommend using <tt>if ( !str.isNull() )</tt> to
268check for a non-null string rather than <tt>if ( !str )</tt>; see <a href="#operator!">operator!</a>() for an explanation.
269<p> Note that if you find that you are mixing usage of <a href="qcstring.html">QCString</a>,
270QString, and <a href="qbytearray.html">QByteArray</a>, this causes lots of unnecessary
271copying and might indicate that the true nature of the data you
272are dealing with is uncertain. If the data is '&#92;0'-terminated 8-bit
273data, use <a href="qcstring.html">QCString</a>; if it is unterminated (i.e. contains '&#92;0's)
2748-bit data, use <a href="qbytearray.html">QByteArray</a>; if it is text, use QString.
275<p> Lists of strings are handled by the <a href="qstringlist.html">QStringList</a> class. You can
276split a string into a list of strings using <a href="qstringlist.html#split">QStringList::split</a>(),
277and join a list of strings into a single string with an optional
278separator using <a href="qstringlist.html#join">QStringList::join</a>(). You can obtain a list of
279strings from a string list that contain a particular substring or
280that match a particular <a href="qregexp.html">regex</a> using
281<a href="qstringlist.html#grep">QStringList::grep</a>().
282<p> <b>Note for C programmers</b>
283<p> Due to C++'s type system and the fact that QString is <a href="shclass.html#implicitly-shared">implicitly shared</a>, QStrings can be treated like ints or other simple base
284types. For example:
285<p> <pre>
286 QString boolToString( bool b )
287 {
288 QString result;
289 if ( b )
290 result = "True";
291 else
292 result = "False";
293 return result;
294 }
295 </pre>
296
297<p> The variable, result, is an auto variable allocated on the stack.
298When return is called, because we're returning by value, The copy
299constructor is called and a copy of the string is returned. (No
300actual copying takes place thanks to the <a href="shclass.html#implicit-sharing">implicit sharing</a>, see
301below.)
302<p> Throughout Qt's source code you will encounter QString usages like
303this:
304<pre>
305 QString func( const QString&amp; input )
306 {
307 QString output = input;
308 // process output
309 return output;
310 }
311 </pre>
312
313<p> The 'copying' of input to output is almost as fast as copying a
314pointer because behind the scenes copying is achieved by
315incrementing a reference count. QString (like all Qt's implicitly
316shared classes) operates on a copy-on-write basis, only copying if
317an instance is actually changed.
318<p> If you wish to create a <a href="shclass.html#deep-copy">deep copy</a> of a QString without losing any
319Unicode information then you should use <a href="qdeepcopy.html">QDeepCopy</a>.
320<p> <p>See also <a href="qchar.html">QChar</a>, <a href="qcstring.html">QCString</a>, <a href="qbytearray.html">QByteArray</a>, <a href="qconststring.html">QConstString</a>, <a href="shared.html">Implicitly and Explicitly Shared Classes</a>, <a href="text.html">Text Related Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
321
322<hr><h2>Member Type Documentation</h2>
323<h3 class=fn><a name="SectionFlags-enum"></a>QString::SectionFlags</h3>
324
325<ul>
326<li><tt>QString::SectionDefault</tt> - Empty fields are counted, leading and
327trailing separators are not included, and the separator is
328compared case sensitively.
329<li><tt>QString::SectionSkipEmpty</tt> - Treat empty fields as if they don't exist,
330i.e. they are not considered as far as <em>start</em> and <em>end</em> are
331concerned.
332<li><tt>QString::SectionIncludeLeadingSep</tt> - Include the leading separator (if
333any) in the result string.
334<li><tt>QString::SectionIncludeTrailingSep</tt> - Include the trailing separator
335(if any) in the result string.
336<li><tt>QString::SectionCaseInsensitiveSeps</tt> - Compare the separator
337case-insensitively.
338</ul><p> Any of the last four values can be OR-ed together to form a flag.
339<p> <p>See also <a href="#section">section</a>().
340
341<hr><h2>Member Function Documentation</h2>
342<h3 class=fn><a name="QString"></a>QString::QString ()
343</h3>
344
345<p> Constructs a null string, i.e. both the length and data pointer
346are 0.
347<p> <p>See also <a href="#isNull">isNull</a>().
348
349<h3 class=fn><a name="QString-2"></a>QString::QString ( <a href="qchar.html">QChar</a>&nbsp;ch )
350</h3>
351Constructs a string of length one, containing the character <em>ch</em>.
352
353<h3 class=fn><a name="QString-3"></a>QString::QString ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
354</h3>
355Constructs an <a href="shclass.html#implicitly-shared">implicitly shared</a> copy of <em>s</em>. This is very fast
356since it only involves incrementing a reference count.
357
358<h3 class=fn><a name="QString-4"></a>QString::QString ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;ba )
359</h3>
360Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>ba</em> interpreted as a
361classic C string.
362
363<h3 class=fn><a name="QString-5"></a>QString::QString ( const&nbsp;<a href="qchar.html">QChar</a>&nbsp;*&nbsp;unicode, uint&nbsp;length )
364</h3>
365Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of the first <em>length</em>
366characters in the <a href="qchar.html">QChar</a> array.
367<p> If <em>unicode</em> and <em>length</em> are 0, then a null string is created.
368<p> If only <em>unicode</em> is 0, the string is empty but has <em>length</em>
369characters of space preallocated: QString expands automatically
370anyway, but this may speed up some cases a little. We recommend
371using the plain constructor and <a href="#setLength">setLength</a>() for this purpose since
372it will result in more readable code.
373<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#setLength">setLength</a>().
374
375<h3 class=fn><a name="QString-6"></a>QString::QString ( const&nbsp;char&nbsp;*&nbsp;str )
376</h3>
377Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>, interpreted as
378a classic C string. The encoding is assumed to be Latin-1, unless
379you change it using <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>().
380<p> If <em>str</em> is 0, then a null string is created.
381<p> This is a cast constructor, but it is perfectly safe: converting a
382Latin-1 <tt>const char *</tt> to QString preserves all the information. You
383can disable this constructor by defining <tt>QT_NO_CAST_ASCII</tt> when
384you compile your applications. You can also make QString objects
385by using <a href="#setLatin1">setLatin1</a>(), <a href="#fromLatin1">fromLatin1</a>(), <a href="#fromLocal8Bit">fromLocal8Bit</a>(), and
386<a href="#fromUtf8">fromUtf8</a>(). Or whatever encoding is appropriate for the 8-bit data
387you have.
388<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#fromAscii">fromAscii</a>().
389
390<h3 class=fn><a name="QString-7"></a>QString::QString ( const&nbsp;std::string&nbsp;&amp;&nbsp;str )
391</h3>
392Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>.
393<p> This is the same as <a href="#fromAscii">fromAscii</a>(<em>str</em>).
394
395<h3 class=fn><a name="~QString"></a>QString::~QString ()
396</h3>
397
398<p> Destroys the string and frees the string's data if this is the
399last reference to the string.
400
401<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="append"></a>QString::append ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str )
402</h3>
403
404<p> Appends <em>str</em> to the string and returns a reference to the
405result.
406<p> <pre>
407 string = "Test";
408 string.append( "ing" ); // string == "Testing"
409 </pre>
410
411<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
412
413<p>Example: <a href="dirview-example.html#x1701">dirview/dirview.cpp</a>.
414<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="append-2"></a>QString::append ( char&nbsp;ch )
415</h3>
416
417<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
418<p> Appends character <em>ch</em> to the string and returns a reference to
419the result.
420<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
421
422<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="append-3"></a>QString::append ( <a href="qchar.html">QChar</a>&nbsp;ch )
423</h3>
424
425<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
426<p> Appends character <em>ch</em> to the string and returns a reference to
427the result.
428<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
429
430<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="append-4"></a>QString::append ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;str )
431</h3>
432This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
433<p> Appends <em>str</em> to the string and returns a reference to the result.
434<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
435
436<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="append-5"></a>QString::append ( const&nbsp;char&nbsp;*&nbsp;str )
437</h3>
438This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
439<p> Appends <em>str</em> to the string and returns a reference to the result.
440<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
441
442<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="append-6"></a>QString::append ( const&nbsp;std::string&nbsp;&amp;&nbsp;str )
443</h3>
444This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
445<p> Appends <em>str</em> to the string and returns a reference to the result.
446<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
447
448<h3 class=fn><a href="qstring.html">QString</a> <a name="arg"></a>QString::arg ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a, int&nbsp;fieldWidth = 0 ) const
449</h3>
450This function will return a string that replaces the lowest
451numbered occurrence of <tt>%1</tt>, <tt>%2</tt>, ..., <tt>%9</tt> with <em>a</em>.
452<p> The <em>fieldWidth</em> value specifies the minimum amount of space that
453<em>a</em> is padded to. A positive value will produce right-aligned
454text, whereas a negative value will produce left-aligned text.
455<p> The following example shows how we could create a 'status' string
456when processing a list of files:
457<pre>
458 QString status = <a href="#QString">QString</a>( "Processing file %1 of %2: %3" )
459 .arg( i ) // current file's number
460 .arg( total ) // number of files to process
461 .arg( fileName ); // current file's name
462 </pre>
463
464<p> It is generally fine to use filenames and numbers as we have done
465in the example above. But note that using <a href="#arg">arg</a>() to construct
466natural language sentences does not usually translate well into
467other languages because sentence structure and word order often
468differ between languages.
469<p> If there is no place marker (<tt>%1</tt>, <tt>%2</tt>, etc.), a warning
470message (<a href="qapplication.html#qWarning">qWarning</a>()) is output and the result is undefined.
471<p> <b>Warning:</b> If any placeholder occurs more than once, the result is undefined.
472<p>
473<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-2"></a>QString::arg ( long&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
474</h3>
475This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
476<p> The <em>fieldWidth</em> value specifies the minimum amount of space that
477<em>a</em> is padded to. A positive value will produce a right-aligned
478number, whereas a negative value will produce a left-aligned
479number.
480<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
481be between 2 and 36.
482<p> The '%' can be followed by an 'L', in which case the sequence is
483replaced with a localized representation of <em>a</em>. The conversion
484uses the default locale. The default locale is determined from the
485system's locale settings at application startup. It can be changed
486using <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). The 'L' flag is ignored if <em>base</em> is
487not 10.
488<p> <pre>
489 QString str;
490 str = <a href="#QString">QString</a>( "Decimal 63 is %1 in hexadecimal" )
491 .arg( 63, 0, 16 );
492 // str == "Decimal 63 is 3f in hexadecimal"
493
494 QLocale::<a href="qlocale.html#setDefault">setDefault</a>(QLocale::English, QLocale::UnitedStates);
495 str = <a href="#QString">QString</a>( "%1 %L2 %L3" )
496 .arg( 12345 )
497 .arg( 12345 )
498 .arg( 12345, 0, 16 );
499 // str == "12345 12,345 3039"
500 </pre>
501
502
503<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-3"></a>QString::arg ( ulong&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
504</h3>
505This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
506<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
507be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
508to produce localized strings.
509
510<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-4"></a>QString::arg ( Q_LLONG&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
511</h3>
512This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
513<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
514be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
515to produce localized strings.
516
517<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-5"></a>QString::arg ( Q_ULLONG&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
518</h3>
519This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
520<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
521be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
522to produce localized strings.
523
524<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-6"></a>QString::arg ( int&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
525</h3>
526
527<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
528<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
529be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
530to produce localized strings.
531
532<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-7"></a>QString::arg ( uint&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
533</h3>
534
535<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
536<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
537be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
538to produce localized strings.
539
540<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-8"></a>QString::arg ( short&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
541</h3>
542
543<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
544<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
545be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
546to produce localized strings.
547
548<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-9"></a>QString::arg ( ushort&nbsp;a, int&nbsp;fieldWidth = 0, int&nbsp;base = 10 ) const
549</h3>
550
551<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
552<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
553be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
554to produce localized strings.
555
556<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-a"></a>QString::arg ( double&nbsp;a, int&nbsp;fieldWidth = 0, char&nbsp;fmt = 'g', int&nbsp;prec = -1 ) const
557</h3>
558This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
559<p> <a name="arg-formats"></a>
560<p> Argument <em>a</em> is formatted according to the <em>fmt</em> format specified,
561which is 'g' by default and can be any of the following:
562<p> <center><table cellpadding="4" cellspacing="2" border="0">
563<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Meaning
564<tr bgcolor="#f0f0f0"> <td valign="top"><tt>e</tt> <td valign="top">format as [-]9.9e[+|-]999
565<tr bgcolor="#d0d0d0"> <td valign="top"><tt>E</tt> <td valign="top">format as [-]9.9E[+|-]999
566<tr bgcolor="#f0f0f0"> <td valign="top"><tt>f</tt> <td valign="top">format as [-]9.9
567<tr bgcolor="#d0d0d0"> <td valign="top"><tt>g</tt> <td valign="top">use <tt>e</tt> or <tt>f</tt> format, whichever is the most concise
568<tr bgcolor="#f0f0f0"> <td valign="top"><tt>G</tt> <td valign="top">use <tt>E</tt> or <tt>f</tt> format, whichever is the most concise
569</table></center>
570<p> With 'e', 'E', and 'f', <em>prec</em> is the number of digits after the
571decimal point. With 'g' and 'G', <em>prec</em> is the maximum number of
572significant digits (trailing zeroes are omitted).
573<p> <pre>
574 double d = 12.34;
575 QString ds = <a href="#QString">QString</a>( "'E' format, precision 3, gives %1" )
576 .arg( d, 0, 'E', 3 );
577 // ds == "'E' format, precision 3, gives 1.234E+01"
578 </pre>
579
580<p> The '%L' syntax can be used to produce localized strings.
581
582<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-b"></a>QString::arg ( char&nbsp;a, int&nbsp;fieldWidth = 0 ) const
583</h3>
584This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
585<p> <em>a</em> is assumed to be in the Latin-1 character set.
586
587<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-c"></a>QString::arg ( <a href="qchar.html">QChar</a>&nbsp;a, int&nbsp;fieldWidth = 0 ) const
588</h3>
589This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
590<p>
591<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-d"></a>QString::arg ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a2 ) const
592</h3>
593
594<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
595<p> This is the same as str.<a href="#arg">arg</a>(<em>a1</em>).arg(<em>a2</em>), except that
596the strings are replaced in one pass. This can make a difference
597if <em>a1</em> contains e.g. <tt>%1</tt>:
598<p> <pre>
599 QString str( "%1 %2" );
600 str.<a href="#arg">arg</a>( "Hello", "world" ); // returns "Hello world"
601 str.<a href="#arg">arg</a>( "Hello" ).arg( "world" ); // returns "Hello world"
602
603 str.<a href="#arg">arg</a>( "(%1)", "Hello" ); // returns "(%1) Hello"
604 str.<a href="#arg">arg</a>( "(%1)" ).arg( "Hello" ); // returns "(Hello) %2"
605 </pre>
606
607
608<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-e"></a>QString::arg ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a2, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a3 ) const
609</h3>
610
611This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
612<p> This is the same as calling str.<a href="#arg">arg</a>(<em>a1</em>).arg(<em>a2</em>).arg(<em>a3</em>),
613except that the strings are replaced in one pass.
614
615<h3 class=fn><a href="qstring.html">QString</a> <a name="arg-f"></a>QString::arg ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a2, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a3, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;a4 ) const
616</h3>
617
618This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
619<p> This is the same as calling
620str.<a href="#arg">arg</a>(<em>a1</em>).arg(<em>a2</em>).arg(<em>a3</em>).arg(<em>a4</em>),
621except that the strings are replaced in one pass.
622
623<h3 class=fn>const char * <a name="ascii"></a>QString::ascii () const
624</h3>
625Returns an 8-bit ASCII representation of the string.
626<p> If a codec has been set using <a href="qtextcodec.html#codecForCStrings">QTextCodec::codecForCStrings</a>(),
627it is used to convert Unicode to 8-bit char. Otherwise, this function
628does the same as <a href="#latin1">latin1</a>().
629<p> <p>See also <a href="#fromAscii">fromAscii</a>(), <a href="#latin1">latin1</a>(), <a href="#utf8">utf8</a>(), and <a href="#local8Bit">local8Bit</a>().
630
631<p>Example: <a href="networkprotocol-example.html#x690">network/networkprotocol/nntp.cpp</a>.
632<h3 class=fn><a href="qchar.html">QChar</a> <a name="at"></a>QString::at ( uint&nbsp;i ) const
633</h3>
634
635<p> Returns the character at index <em>i</em>, or 0 if <em>i</em> is beyond the
636length of the string.
637<p> <pre>
638 const QString string( "abcdefgh" );
639 <a href="qchar.html">QChar</a> ch = string.<a href="#at">at</a>( 4 );
640 // ch == 'e'
641 </pre>
642
643<p> If the QString is not const (i.e. const QString) or const& (i.e.
644const QString &), then the non-const overload of <a href="#at">at</a>() will be used
645instead.
646
647<h3 class=fn><a href="qcharref.html">QCharRef</a> <a name="at-2"></a>QString::at ( uint&nbsp;i )
648</h3>
649
650<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
651<p> The function returns a reference to the character at index <em>i</em>.
652The resulting reference can then be assigned to, or used
653immediately, but it will become invalid once further modifications
654are made to the original string.
655<p> If <em>i</em> is beyond the length of the string then the string is
656expanded with QChar::null.
657
658<h3 class=fn>uint <a name="capacity"></a>QString::capacity () const
659</h3>
660
661<p> Returns the number of characters this string can hold
662in the allocated memory.
663<p> <p>See also <a href="#reserve">reserve</a>() and <a href="#squeeze">squeeze</a>().
664
665<h3 class=fn>int <a name="compare"></a>QString::compare ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )<tt> [static]</tt>
666</h3>
667
668<p> Lexically compares <em>s1</em> with <em>s2</em> and returns an integer less
669than, equal to, or greater than zero if <em>s1</em> is less than, equal
670to, or greater than <em>s2</em>.
671<p> The comparison is based exclusively on the numeric Unicode values
672of the characters and is very fast, but is not what a human would
673expect. Consider sorting user-interface strings with
674<a href="#localeAwareCompare">QString::localeAwareCompare</a>().
675<p> <pre>
676 int a = QString::<a href="#compare">compare</a>( "def", "abc" ); // a &gt; 0
677 int b = QString::<a href="#compare">compare</a>( "abc", "def" ); // b &lt; 0
678 int c = QString::<a href="#compare">compare</a>( "abc", "abc" ); // c == 0
679 </pre>
680
681
682<h3 class=fn>int <a name="compare-2"></a>QString::compare ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s ) const
683</h3>
684This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
685<p> Lexically compares this string with <em>s</em> and returns an integer
686less than, equal to, or greater than zero if it is less than, equal
687to, or greater than <em>s</em>.
688
689<h3 class=fn>void <a name="compose"></a>QString::compose ()
690</h3>
691<b>Warning:</b> This function is not supported in Qt 3.x. It is provided
692for experimental and illustrative purposes only. It is mainly of
693interest to those experimenting with Arabic and other
694composition-rich texts.
695<p> Applies possible ligatures to a QString. Useful when
696composition-rich text requires rendering with glyph-poor fonts,
697but it also makes compositions such as <a href="qchar.html">QChar</a>(0x0041) ('A') and
698QChar(0x0308) (Unicode accent diaresis), giving QChar(0x00c4)
699(German A Umlaut).
700
701<h3 class=fn><a href="qchar.html">QChar</a> <a name="constref"></a>QString::constref ( uint&nbsp;i ) const
702</h3>
703
704<p> Returns the <a href="qchar.html">QChar</a> at index <em>i</em> by value.
705<p> Equivalent to <a href="#at">at</a>(<em>i</em>).
706<p> <p>See also <a href="#ref">ref</a>().
707
708<h3 class=fn>int <a name="contains"></a>QString::contains ( <a href="qchar.html">QChar</a>&nbsp;c, bool&nbsp;cs = TRUE ) const
709</h3>
710Returns the number of times the character <em>c</em> occurs in the
711string.
712<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
713otherwise the search is case insensitive.
714<p> <pre>
715 QString string( "Trolltech and Qt" );
716 int n = string.<a href="#contains">contains</a>( 't', FALSE );
717 // n == 3
718 </pre>
719
720
721<p>Examples: <a href="fileiconview-example.html#x867">fileiconview/qfileiconview.cpp</a> and <a href="mdi-example.html#x2064">mdi/application.cpp</a>.
722<h3 class=fn>int <a name="contains-2"></a>QString::contains ( char&nbsp;c, bool&nbsp;cs = TRUE ) const
723</h3>
724
725<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
726<p>
727<h3 class=fn>int <a name="contains-3"></a>QString::contains ( const&nbsp;char&nbsp;*&nbsp;str, bool&nbsp;cs = TRUE ) const
728</h3>
729This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
730<p> Returns the number of times the string <em>str</em> occurs in the string.
731<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
732otherwise the search is case insensitive.
733
734<h3 class=fn>int <a name="contains-4"></a>QString::contains ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str, bool&nbsp;cs = TRUE ) const
735</h3>
736This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
737<p> Returns the number of times <em>str</em> occurs in the string.
738<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
739otherwise the search is case insensitive.
740<p> This function counts overlapping strings, so in the example below,
741there are two instances of "ana" in "bananas".
742<p> <pre>
743 QString str( "bananas" );
744 int i = str.<a href="#contains">contains</a>( "ana" ); // i == 2
745 </pre>
746
747<p> <p>See also <a href="#findRev">findRev</a>().
748
749<h3 class=fn>int <a name="contains-5"></a>QString::contains ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx ) const
750</h3>
751This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
752<p> Returns the number of times the regexp, <em>rx</em>, matches in the
753string.
754<p> This function counts overlapping matches, so in the example below,
755there are four instances of "ana" or "ama".
756<p> <pre>
757 QString str = "banana and panama";
758 <a href="qregexp.html">QRegExp</a> rxp = QRegExp( "a[nm]a", TRUE, FALSE );
759 int i = str.<a href="#contains">contains</a>( rxp ); // i == 4
760 </pre>
761
762<p> <p>See also <a href="#find">find</a>() and <a href="#findRev">findRev</a>().
763
764<h3 class=fn><a href="qstring.html">QString</a> <a name="copy"></a>QString::copy () const
765</h3>
766
767<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
768<p> In Qt 2.0 and later, all calls to this function are needless. Just
769remove them.
770
771<h3 class=fn>const char * <a name="data"></a>QString::data () const
772</h3>
773
774<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
775<p> Returns a pointer to a '&#92;0'-terminated classic C string.
776<p> In Qt 1.x, this returned a char* allowing direct manipulation of the
777string as a sequence of bytes. In Qt 2.x where QString is a Unicode
778string, char* conversion constructs a temporary string, and hence
779direct character operations are meaningless.
780
781<h3 class=fn>bool <a name="endsWith"></a>QString::endsWith ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, bool&nbsp;cs = TRUE ) const
782</h3>
783Returns TRUE if the string ends with <em>s</em>; otherwise returns
784FALSE.
785<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
786otherwise the search is case insensitive.
787<p> <pre>
788 QString str( "Bananas" );
789 str.<a href="#endsWith">endsWith</a>( "anas" ); // returns TRUE
790 str.<a href="#endsWith">endsWith</a>( "pple" ); // returns FALSE
791 </pre>
792
793<p> <p>See also <a href="#startsWith">startsWith</a>().
794
795<p>Example: <a href="tutorial2-04.html#x2561">chart/main.cpp</a>.
796<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="fill"></a>QString::fill ( <a href="qchar.html">QChar</a>&nbsp;c, int&nbsp;len = -1 )
797</h3>
798Fills the string with <em>len</em> characters of value <em>c</em>, and returns
799a reference to the string.
800<p> If <em>len</em> is negative (the default), the current string length is
801used.
802<p> <pre>
803 QString str;
804 str.<a href="#fill">fill</a>( 'g', 5 ); // string == "ggggg"
805 </pre>
806
807
808<h3 class=fn>int <a name="find"></a>QString::find ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx, int&nbsp;index = 0 ) const
809</h3>
810Finds the first match of the <a href="qregexp.html#regular-expression">regular expression</a> <em>rx</em>, starting
811from position <em>index</em>. If <em>index</em> is -1, the search starts at
812the last character; if -2, at the next to last character and so
813on. (See <a href="#findRev">findRev</a>() for searching backwards.)
814<p> Returns the position of the first match of <em>rx</em> or -1 if no match
815was found.
816<p> <pre>
817 QString string( "bananas" );
818 int i = string.<a href="#find">find</a>( QRegExp("an"), 0 ); // i == 1
819 </pre>
820
821<p> <p>See also <a href="#findRev">findRev</a>(), <a href="#replace">replace</a>(), and <a href="#contains">contains</a>().
822
823<p>Example: <a href="mail-example.html#x715">network/mail/smtp.cpp</a>.
824<h3 class=fn>int <a name="find-2"></a>QString::find ( <a href="qchar.html">QChar</a>&nbsp;c, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const
825</h3>
826This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
827<p> Finds the first occurrence of the character <em>c</em>, starting at
828position <em>index</em>. If <em>index</em> is -1, the search starts at the
829last character; if -2, at the next to last character and so on.
830(See <a href="#findRev">findRev</a>() for searching backwards.)
831<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
832otherwise the search is case insensitive.
833<p> Returns the position of <em>c</em> or -1 if <em>c</em> could not be found.
834
835<h3 class=fn>int <a name="find-3"></a>QString::find ( char&nbsp;c, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const
836</h3>
837
838<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
839<p> Find character <em>c</em> starting from position <em>index</em>.
840<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
841otherwise the search is case insensitive.
842
843<h3 class=fn>int <a name="find-4"></a>QString::find ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const
844</h3>
845This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
846<p> Finds the first occurrence of the string <em>str</em>, starting at
847position <em>index</em>. If <em>index</em> is -1, the search starts at the
848last character, if it is -2, at the next to last character and so
849on. (See <a href="#findRev">findRev</a>() for searching backwards.)
850<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
851otherwise the search is case insensitive.
852<p> Returns the position of <em>str</em> or -1 if <em>str</em> could not be found.
853
854<h3 class=fn>int <a name="find-5"></a>QString::find ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = 0 ) const
855</h3>
856
857<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
858<p> Equivalent to <a href="#find">find</a>(QString(<em>str</em>), <em>index</em>).
859
860<h3 class=fn>int <a name="findRev"></a>QString::findRev ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = -1 ) const
861</h3>
862
863<p> Equivalent to <a href="#findRev">findRev</a>(QString(<em>str</em>), <em>index</em>).
864
865<h3 class=fn>int <a name="findRev-2"></a>QString::findRev ( <a href="qchar.html">QChar</a>&nbsp;c, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const
866</h3>
867This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
868<p> Finds the first occurrence of the character <em>c</em>, starting at
869position <em>index</em> and searching backwards. If the index is -1, the
870search starts at the last character, if it is -2, at the next to
871last character and so on.
872<p> Returns the position of <em>c</em> or -1 if <em>c</em> could not be found.
873<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
874otherwise the search is case insensitive.
875<p> <pre>
876 QString string( "bananas" );
877 int i = string.<a href="#findRev">findRev</a>( 'a' ); // i == 5
878 </pre>
879
880
881<h3 class=fn>int <a name="findRev-3"></a>QString::findRev ( char&nbsp;c, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const
882</h3>
883
884<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
885<p> Find character <em>c</em> starting from position <em>index</em> and working
886backwards.
887<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
888otherwise the search is case insensitive.
889
890<h3 class=fn>int <a name="findRev-4"></a>QString::findRev ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const
891</h3>
892This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
893<p> Finds the first occurrence of the string <em>str</em>, starting at
894position <em>index</em> and searching backwards. If the index is -1, the
895search starts at the last character, if it is -2, at the next to
896last character and so on.
897<p> Returns the position of <em>str</em> or -1 if <em>str</em> could not be found.
898<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
899otherwise the search is case insensitive.
900<p> <pre>
901 QString string("bananas");
902 int i = string.<a href="#findRev">findRev</a>( "ana" ); // i == 3
903 </pre>
904
905
906<h3 class=fn>int <a name="findRev-5"></a>QString::findRev ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx, int&nbsp;index = -1 ) const
907</h3>
908This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
909<p> Finds the first match of the regexp <em>rx</em>, starting at position <em>index</em> and searching backwards. If the index is -1, the search
910starts at the last character, if it is -2, at the next to last
911character and so on. (See <a href="#findRev">findRev</a>() for searching backwards.)
912<p> Returns the position of the match or -1 if no match was found.
913<p> <pre>
914 QString string( "bananas" );
915 int i = string.<a href="#findRev">findRev</a>( QRegExp("an") ); // i == 3
916 </pre>
917
918<p> <p>See also <a href="#find">find</a>().
919
920<h3 class=fn><a href="qstring.html">QString</a> <a name="fromAscii"></a>QString::fromAscii ( const&nbsp;char&nbsp;*&nbsp;ascii, int&nbsp;len = -1 )<tt> [static]</tt>
921</h3>
922Returns the Unicode string decoded from the first <em>len</em>
923bytes of <em>ascii</em>, ignoring the rest of <em>ascii</em>. If <em>len</em>
924is -1 then the length of <em>ascii</em> is used. If <em>len</em> is bigger
925than the length of <em>ascii</em> then it will use the length of <em>ascii</em>.
926<p> If a codec has been set using <a href="qtextcodec.html#codecForCStrings">QTextCodec::codecForCStrings</a>(),
927it is used to convert the string from 8-bit characters to Unicode.
928Otherwise, this function does the same as <a href="#fromLatin1">fromLatin1</a>().
929<p> This is the same as the QString(const char*) constructor, but you
930can make that constructor invisible if you compile with the define
931<tt>QT_NO_CAST_ASCII</tt>, in which case you can explicitly create a
932QString from 8-bit ASCII text using this function.
933<p> <pre>
934 QString str = QString::<a href="#fromAscii">fromAscii</a>( "123456789", 5 );
935 // str == "12345"
936 </pre>
937
938
939<h3 class=fn><a href="qstring.html">QString</a> <a name="fromLatin1"></a>QString::fromLatin1 ( const&nbsp;char&nbsp;*&nbsp;chars, int&nbsp;len = -1 )<tt> [static]</tt>
940</h3>
941Returns the Unicode string decoded from the first <em>len</em>
942bytes of <em>chars</em>, ignoring the rest of <em>chars</em>. If <em>len</em>
943is -1 then the length of <em>chars</em> is used. If <em>len</em> is bigger
944than the length of <em>chars</em> then it will use the length of <em>chars</em>.
945<p> <p>See also <a href="#fromAscii">fromAscii</a>().
946
947<p>Examples: <a href="listbox-example.html#x1446">listbox/listbox.cpp</a> and <a href="mail-example.html#x716">network/mail/smtp.cpp</a>.
948<h3 class=fn><a href="qstring.html">QString</a> <a name="fromLocal8Bit"></a>QString::fromLocal8Bit ( const&nbsp;char&nbsp;*&nbsp;local8Bit, int&nbsp;len = -1 )<tt> [static]</tt>
949</h3>
950Returns the Unicode string decoded from the first <em>len</em>
951bytes of <em>local8Bit</em>, ignoring the rest of <em>local8Bit</em>. If
952<em>len</em> is -1 then the length of <em>local8Bit</em> is used. If <em>len</em> is
953bigger than the length of <em>local8Bit</em> then it will use the length
954of <em>local8Bit</em>.
955<p> <pre>
956 QString str = QString::<a href="#fromLocal8Bit">fromLocal8Bit</a>( "123456789", 5 );
957 // str == "12345"
958 </pre>
959
960<p> <em>local8Bit</em> is assumed to be encoded in a locale-specific format.
961<p> See <a href="qtextcodec.html">QTextCodec</a> for more diverse coding/decoding of Unicode strings.
962
963<h3 class=fn><a href="qstring.html">QString</a> <a name="fromUcs2"></a>QString::fromUcs2 ( const&nbsp;unsigned&nbsp;short&nbsp;*&nbsp;str )<tt> [static]</tt>
964</h3>
965Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>, interpreted as a
966UCS2 encoded, zero terminated, Unicode string.
967<p> If <em>str</em> is 0, then a null string is created.
968<p> <p>See also <a href="#isNull">isNull</a>().
969
970<h3 class=fn><a href="qstring.html">QString</a> <a name="fromUtf8"></a>QString::fromUtf8 ( const&nbsp;char&nbsp;*&nbsp;utf8, int&nbsp;len = -1 )<tt> [static]</tt>
971</h3>
972Returns the Unicode string decoded from the first <em>len</em>
973bytes of <em>utf8</em>, ignoring the rest of <em>utf8</em>. If <em>len</em> is
974-1 then the length of <em>utf8</em> is used. If <em>len</em> is bigger than
975the length of <em>utf8</em> then it will use the length of <em>utf8</em>.
976<p> <pre>
977 QString str = QString::<a href="#fromUtf8">fromUtf8</a>( "123456789", 5 );
978 // str == "12345"
979 </pre>
980
981<p> See <a href="qtextcodec.html">QTextCodec</a> for more diverse coding/decoding of Unicode strings.
982
983<p>Example: <a href="simple-font-demo-example.html#x2850">fonts/simple-qfont-demo/viewer.cpp</a>.
984<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="insert"></a>QString::insert ( uint&nbsp;index, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
985</h3>
986Inserts <em>s</em> into the string at position <em>index</em>.
987<p> If <em>index</em> is beyond the end of the string, the string is
988extended with spaces to length <em>index</em> and <em>s</em> is then appended
989and returns a reference to the string.
990<p> <pre>
991 QString string( "I like fish" );
992 str = string.<a href="#insert">insert</a>( 2, "don't " );
993 // str == "I don't like fish"
994 </pre>
995
996<p> <p>See also <a href="#remove">remove</a>() and <a href="#replace">replace</a>().
997
998<p>Examples: <a href="themes-example.html#x337">themes/themes.cpp</a> and <a href="xform-example.html#x1264">xform/xform.cpp</a>.
999<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="insert-2"></a>QString::insert ( uint&nbsp;index, const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;s )
1000</h3>
1001This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1002<p> Inserts <em>s</em> into the string at position <em>index</em> and returns
1003a reference to the string.
1004
1005<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="insert-3"></a>QString::insert ( uint&nbsp;index, const&nbsp;char&nbsp;*&nbsp;s )
1006</h3>
1007This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1008<p> Inserts <em>s</em> into the string at position <em>index</em> and returns
1009a reference to the string.
1010
1011<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="insert-4"></a>QString::insert ( uint&nbsp;index, const&nbsp;<a href="qchar.html">QChar</a>&nbsp;*&nbsp;s, uint&nbsp;len )
1012</h3>
1013This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1014<p> Inserts the first <em>len</em> characters in <em>s</em> into the string at
1015position <em>index</em> and returns a reference to the string.
1016
1017<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="insert-5"></a>QString::insert ( uint&nbsp;index, <a href="qchar.html">QChar</a>&nbsp;c )
1018</h3>
1019This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1020<p> Insert <em>c</em> into the string at position <em>index</em> and returns a
1021reference to the string.
1022<p> If <em>index</em> is beyond the end of the string, the string is
1023extended with spaces (ASCII 32) to length <em>index</em> and <em>c</em> is
1024then appended.
1025
1026<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="insert-6"></a>QString::insert ( uint&nbsp;index, char&nbsp;c )
1027</h3>
1028
1029<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1030<p> Insert character <em>c</em> at position <em>index</em>.
1031
1032<h3 class=fn>bool <a name="isEmpty"></a>QString::isEmpty () const
1033</h3>
1034
1035<p> Returns TRUE if the string is empty, i.e. if <a href="#length">length</a>() == 0;
1036otherwise returns FALSE. Null strings are also empty.
1037<p> <pre>
1038 QString a( "" );
1039 a.<a href="#isEmpty">isEmpty</a>(); // TRUE
1040 a.<a href="#isNull">isNull</a>(); // FALSE
1041
1042 QString b;
1043 b.<a href="#isEmpty">isEmpty</a>(); // TRUE
1044 b.<a href="#isNull">isNull</a>(); // TRUE
1045 </pre>
1046
1047<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#length">length</a>().
1048
1049<p>Examples: <a href="addressbook-example.html#x571">addressbook/mainwindow.cpp</a>, <a href="canvas-chart-example.html#x2892">chart/chartform.cpp</a>, <a href="tutorial2-06.html#x2576">chart/chartform_canvas.cpp</a>, <a href="networkprotocol-example.html#x691">network/networkprotocol/nntp.cpp</a>, <a href="qmag-example.html#x1792">qmag/qmag.cpp</a>, and <a href="qwerty-example.html#x390">qwerty/qwerty.cpp</a>.
1050<h3 class=fn>bool <a name="isNull"></a>QString::isNull () const
1051</h3>
1052
1053<p> Returns TRUE if the string is null; otherwise returns FALSE. A
1054null string is always empty.
1055<p> <pre>
1056 QString a; // a.<a href="#unicode">unicode</a>() == 0, a.<a href="#length">length</a>() == 0
1057 a.<a href="#isNull">isNull</a>(); // TRUE, because a.<a href="#unicode">unicode</a>() == 0
1058 a.<a href="#isEmpty">isEmpty</a>(); // TRUE, because a.<a href="#length">length</a>() == 0
1059 </pre>
1060
1061<p> <p>See also <a href="#isEmpty">isEmpty</a>() and <a href="#length">length</a>().
1062
1063<p>Examples: <a href="i18n-example.html#x1948">i18n/main.cpp</a>, <a href="ftpclient-example.html#x771">network/ftpclient/ftpmainwindow.ui.h</a>, and <a href="qdir-example.html#x1842">qdir/qdir.cpp</a>.
1064<h3 class=fn>const char * <a name="latin1"></a>QString::latin1 () const
1065</h3>
1066Returns a Latin-1 representation of the string. The
1067returned value is undefined if the string contains non-Latin-1
1068characters. If you want to convert strings into formats other than
1069Unicode, see the <a href="qtextcodec.html">QTextCodec</a> classes.
1070<p> This function is mainly useful for boot-strapping legacy code to
1071use Unicode.
1072<p> The result remains valid so long as one unmodified copy of the
1073source string exists.
1074<p> <p>See also <a href="#fromLatin1">fromLatin1</a>(), <a href="#ascii">ascii</a>(), <a href="#utf8">utf8</a>(), and <a href="#local8Bit">local8Bit</a>().
1075
1076<p>Examples: <a href="fileiconview-example.html#x869">fileiconview/qfileiconview.cpp</a> and <a href="networkprotocol-example.html#x692">network/networkprotocol/nntp.cpp</a>.
1077<h3 class=fn><a href="qstring.html">QString</a> <a name="left"></a>QString::left ( uint&nbsp;len ) const
1078</h3>
1079Returns a substring that contains the <em>len</em> leftmost characters
1080of the string.
1081<p> The whole string is returned if <em>len</em> exceeds the length of the
1082string.
1083<p> <pre>
1084 QString s = "Pineapple";
1085 QString t = s.<a href="#left">left</a>( 4 ); // t == "Pine"
1086 </pre>
1087
1088<p> <p>See also <a href="#right">right</a>(), <a href="#mid">mid</a>(), and <a href="#isEmpty">isEmpty</a>().
1089
1090<p>Example: <a href="themes-example.html#x338">themes/themes.cpp</a>.
1091<h3 class=fn><a href="qstring.html">QString</a> <a name="leftJustify"></a>QString::leftJustify ( uint&nbsp;width, <a href="qchar.html">QChar</a>&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const
1092</h3>
1093Returns a string of length <em>width</em> that contains this string
1094padded by the <em>fill</em> character.
1095<p> If <em>truncate</em> is FALSE and the length of the string is more than
1096<em>width</em>, then the returned string is a copy of the string.
1097<p> If <em>truncate</em> is TRUE and the length of the string is more than
1098<em>width</em>, then any characters in a copy of the string after length
1099<em>width</em> are removed, and the copy is returned.
1100<p> <pre>
1101 QString s( "apple" );
1102 QString t = s.<a href="#leftJustify">leftJustify</a>( 8, '.' ); // t == "apple..."
1103 </pre>
1104
1105<p> <p>See also <a href="#rightJustify">rightJustify</a>().
1106
1107<h3 class=fn>uint <a name="length"></a>QString::length () const
1108</h3>
1109
1110<p> Returns the length of the string.
1111<p> Null strings and empty strings have zero length.
1112<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
1113
1114<p>Examples: <a href="dirview-example.html#x1702">dirview/dirview.cpp</a>, <a href="fileiconview-example.html#x870">fileiconview/qfileiconview.cpp</a>, <a href="networkprotocol-example.html#x693">network/networkprotocol/nntp.cpp</a>, <a href="rot-example.html#x1372">rot13/rot13.cpp</a>, and <a href="themes-example.html#x339">themes/themes.cpp</a>.
1115<h3 class=fn><a href="qcstring.html">QCString</a> <a name="local8Bit"></a>QString::local8Bit () const
1116</h3>
1117Returns the string encoded in a locale-specific format. On X11,
1118this is the <a href="qtextcodec.html#codecForLocale">QTextCodec::codecForLocale</a>(). On Windows, it is a
1119system-defined encoding. On Mac OS X, this always uses UTF-8 as
1120the encoding.
1121<p> See <a href="qtextcodec.html">QTextCodec</a> for more diverse coding/decoding of Unicode
1122strings.
1123<p> <p>See also <a href="#fromLocal8Bit">fromLocal8Bit</a>(), <a href="#ascii">ascii</a>(), <a href="#latin1">latin1</a>(), and <a href="#utf8">utf8</a>().
1124
1125<h3 class=fn>int <a name="localeAwareCompare"></a>QString::localeAwareCompare ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )<tt> [static]</tt>
1126</h3>
1127
1128<p> Compares <em>s1</em> with <em>s2</em> and returns an integer less than, equal
1129to, or greater than zero if <em>s1</em> is less than, equal to, or
1130greater than <em>s2</em>.
1131<p> The comparison is performed in a locale- and also
1132platform-dependent manner. Use this function to present sorted
1133lists of strings to the user.
1134<p> <p>See also <a href="#compare">QString::compare</a>() and <a href="qtextcodec.html#locale">QTextCodec::locale</a>().
1135
1136<h3 class=fn>int <a name="localeAwareCompare-2"></a>QString::localeAwareCompare ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s ) const
1137</h3>
1138This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1139<p> Compares this string with <em>s</em>.
1140
1141<h3 class=fn><a href="qstring.html">QString</a> <a name="lower"></a>QString::lower () const
1142</h3>
1143Returns a lowercase copy of the string.
1144<p> <pre>
1145 QString string( "TROlltECH" );
1146 str = string.<a href="#lower">lower</a>(); // str == "trolltech"
1147 </pre>
1148
1149<p> <p>See also <a href="#upper">upper</a>().
1150
1151<p>Example: <a href="scribble-example.html#x941">scribble/scribble.cpp</a>.
1152<h3 class=fn><a href="qstring.html">QString</a> <a name="mid"></a>QString::mid ( uint&nbsp;index, uint&nbsp;len = 0xffffffff ) const
1153</h3>
1154Returns a string that contains the <em>len</em> characters of this
1155string, starting at position <em>index</em>.
1156<p> Returns a null string if the string is empty or <em>index</em> is out of
1157range. Returns the whole string from <em>index</em> if <em>index</em> + <em>len</em>
1158exceeds the length of the string.
1159<p> <pre>
1160 QString s( "Five pineapples" );
1161 QString t = s.<a href="#mid">mid</a>( 5, 4 ); // t == "pine"
1162 </pre>
1163
1164<p> <p>See also <a href="#left">left</a>() and <a href="#right">right</a>().
1165
1166<p>Examples: <a href="mail-example.html#x717">network/mail/smtp.cpp</a>, <a href="qmag-example.html#x1793">qmag/qmag.cpp</a>, and <a href="themes-example.html#x340">themes/themes.cpp</a>.
1167<h3 class=fn><a href="qstring.html">QString</a> <a name="number"></a>QString::number ( long&nbsp;n, int&nbsp;base = 10 )<tt> [static]</tt>
1168</h3>
1169A convenience function that returns a string equivalent of the
1170number <em>n</em> to base <em>base</em>, which is 10 by default and must be
1171between 2 and 36. The returned string is in "C" locale.
1172<p> <pre>
1173 long a = 63;
1174 QString str = QString::<a href="#number">number</a>( a, 16 ); // str == "3f"
1175 QString str = QString::<a href="#number">number</a>( a, 16 ).upper(); // str == "3F"
1176 </pre>
1177
1178<p> <p>See also <a href="#setNum">setNum</a>().
1179
1180<p>Examples: <a href="simple-application-example.html#x1580">application/application.cpp</a>, <a href="canvas-chart-example.html#x2893">chart/chartform.cpp</a>, <a href="simple-font-demo-example.html#x2851">fonts/simple-qfont-demo/viewer.cpp</a>, <a href="helpviewer-example.html#x1018">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2066">mdi/application.cpp</a>, <a href="regexptester-example.html#x2496">regexptester/regexptester.cpp</a>, and <a href="sql.html#x2193">sql/overview/extract/main.cpp</a>.
1181<h3 class=fn><a href="qstring.html">QString</a> <a name="number-2"></a>QString::number ( ulong&nbsp;n, int&nbsp;base = 10 )<tt> [static]</tt>
1182</h3>
1183This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1184<p> <p>See also <a href="#setNum">setNum</a>().
1185
1186<h3 class=fn><a href="qstring.html">QString</a> <a name="number-3"></a>QString::number ( Q_LLONG&nbsp;n, int&nbsp;base = 10 )<tt> [static]</tt>
1187</h3>
1188This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1189<p> <p>See also <a href="#setNum">setNum</a>().
1190
1191<h3 class=fn><a href="qstring.html">QString</a> <a name="number-4"></a>QString::number ( Q_ULLONG&nbsp;n, int&nbsp;base = 10 )<tt> [static]</tt>
1192</h3>
1193This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1194<p> <p>See also <a href="#setNum">setNum</a>().
1195
1196<h3 class=fn><a href="qstring.html">QString</a> <a name="number-5"></a>QString::number ( int&nbsp;n, int&nbsp;base = 10 )<tt> [static]</tt>
1197</h3>
1198This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1199<p> <p>See also <a href="#setNum">setNum</a>().
1200
1201<h3 class=fn><a href="qstring.html">QString</a> <a name="number-6"></a>QString::number ( uint&nbsp;n, int&nbsp;base = 10 )<tt> [static]</tt>
1202</h3>
1203This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1204<p> A convenience factory function that returns a string
1205representation of the number <em>n</em> to the base <em>base</em>, which is 10
1206by default and must be between 2 and 36.
1207<p> <p>See also <a href="#setNum">setNum</a>().
1208
1209<h3 class=fn><a href="qstring.html">QString</a> <a name="number-7"></a>QString::number ( double&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )<tt> [static]</tt>
1210</h3>
1211This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1212<p> Argument <em>n</em> is formatted according to the <em>f</em> format specified,
1213which is <tt>g</tt> by default, and can be any of the following:
1214<p> <center><table cellpadding="4" cellspacing="2" border="0">
1215<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Meaning
1216<tr bgcolor="#f0f0f0"> <td valign="top"><tt>e</tt> <td valign="top">format as [-]9.9e[+|-]999
1217<tr bgcolor="#d0d0d0"> <td valign="top"><tt>E</tt> <td valign="top">format as [-]9.9E[+|-]999
1218<tr bgcolor="#f0f0f0"> <td valign="top"><tt>f</tt> <td valign="top">format as [-]9.9
1219<tr bgcolor="#d0d0d0"> <td valign="top"><tt>g</tt> <td valign="top">use <tt>e</tt> or <tt>f</tt> format, whichever is the most concise
1220<tr bgcolor="#f0f0f0"> <td valign="top"><tt>G</tt> <td valign="top">use <tt>E</tt> or <tt>f</tt> format, whichever is the most concise
1221</table></center>
1222<p> With 'e', 'E', and 'f', <em>prec</em> is the number of digits after the
1223decimal point. With 'g' and 'G', <em>prec</em> is the maximum number of
1224significant digits (trailing zeroes are omitted).
1225<p> <pre>
1226 double d = 12.34;
1227 QString ds = <a href="#QString">QString</a>( "'E' format, precision 3, gives %1" )
1228 .arg( d, 0, 'E', 3 );
1229 // ds == "1.234E+001"
1230 </pre>
1231
1232<p> <p>See also <a href="#setNum">setNum</a>().
1233
1234<h3 class=fn><a name="operator-const-char-*"></a>QString::operator const char * () const
1235</h3>
1236
1237<p> Returns <a href="#ascii">ascii</a>(). Be sure to see the warnings documented in the
1238ascii() function. Note that for new code which you wish to be
1239strictly Unicode-clean, you can define the macro <tt>QT_NO_ASCII_CAST</tt> when compiling your code to hide this function so
1240that automatic casts are not done. This has the added advantage
1241that you catch the programming error described in <a href="#operator!">operator!</a>().
1242
1243<h3 class=fn><a name="operator-std::string"></a>QString::operator std::string () const
1244</h3>
1245
1246<p> Returns <a href="#ascii">ascii</a>() as a std::string.
1247<p> <b>Warning:</b> The function may cause an application to crash if a static C run-time is in use.
1248This can happen in Microsoft Visual C++ if Qt is configured as single-threaded. A safe
1249alternative is to call ascii() directly and construct a std::string manually.
1250
1251<h3 class=fn>bool <a name="operator!"></a>QString::operator! () const
1252</h3>
1253
1254<p> Returns TRUE if this is a null string; otherwise returns FALSE.
1255<p> <pre>
1256 QString name = getName();
1257 if ( !name )
1258 name = "Rodney";
1259 </pre>
1260
1261<p> Note that if you say
1262<p> <pre>
1263 QString name = getName();
1264 if ( name )
1265 doSomethingWith(name);
1266 </pre>
1267
1268<p> It will call "operator const char*()", which is inefficent; you
1269may wish to define the macro <tt>QT_NO_ASCII_CAST</tt> when writing code
1270which you wish to remain Unicode-clean.
1271<p> When you want the above semantics, use:
1272<p> <pre>
1273 QString name = getName();
1274 if ( !name.<a href="#isNull">isNull</a>() )
1275 doSomethingWith(name);
1276 </pre>
1277
1278<p> <p>See also <a href="#isEmpty">isEmpty</a>().
1279
1280<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator+-eq"></a>QString::operator+= ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str )
1281</h3>
1282Appends <em>str</em> to the string and returns a reference to the string.
1283
1284<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator+-eq-2"></a>QString::operator+= ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;str )
1285</h3>
1286
1287This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1288<p> Appends <em>str</em> to the string and returns a reference to the string.
1289
1290<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator+-eq-3"></a>QString::operator+= ( const&nbsp;char&nbsp;*&nbsp;str )
1291</h3>
1292This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1293<p> Appends <em>str</em> to the string and returns a reference to the string.
1294
1295<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator+-eq-4"></a>QString::operator+= ( const&nbsp;std::string&nbsp;&amp;&nbsp;str )
1296</h3>
1297
1298This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1299<p> Appends <em>str</em> to the string and returns a reference to the string.
1300
1301<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator+-eq-5"></a>QString::operator+= ( <a href="qchar.html">QChar</a>&nbsp;c )
1302</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1303<p> Appends <em>c</em> to the string and returns a reference to the string.
1304
1305<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator+-eq-6"></a>QString::operator+= ( char&nbsp;c )
1306</h3>
1307This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1308<p> Appends <em>c</em> to the string and returns a reference to the string.
1309
1310<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator-eq"></a>QString::operator= ( <a href="qchar.html">QChar</a>&nbsp;c )
1311</h3>
1312
1313<p> Sets the string to contain just the single character <em>c</em>.
1314
1315<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator-eq-2"></a>QString::operator= ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
1316</h3>
1317This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1318<p> Assigns a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>s</em> to this string and returns a
1319reference to this string. This is very fast because the string
1320isn't actually copied.
1321
1322<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator-eq-3"></a>QString::operator= ( const&nbsp;char&nbsp;*&nbsp;str )
1323</h3>
1324This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1325<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>, interpreted as a classic C string
1326to this string and returns a reference to this string.
1327<p> If <em>str</em> is 0, then a null string is created.
1328<p> <p>See also <a href="#isNull">isNull</a>().
1329
1330<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator-eq-4"></a>QString::operator= ( const&nbsp;std::string&nbsp;&amp;&nbsp;s )
1331</h3>
1332
1333<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1334<p> Makes a <a href="shclass.html#deep-copy">deep copy</a> of <em>s</em> and returns a reference to the deep
1335copy.
1336
1337<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator-eq-5"></a>QString::operator= ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;cstr )
1338</h3>
1339This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1340<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>cstr</em>, interpreted as a classic C
1341string, to this string. Returns a reference to this string.
1342
1343<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="operator-eq-6"></a>QString::operator= ( char&nbsp;c )
1344</h3>
1345
1346<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1347<p> Sets the string to contain just the single character <em>c</em>.
1348
1349<h3 class=fn><a href="qchar.html">QChar</a> <a name="operator[]"></a>QString::operator[] ( int&nbsp;i ) const
1350</h3>
1351
1352<p> Returns the character at index <em>i</em>, or QChar::null if <em>i</em> is
1353beyond the length of the string.
1354<p> If the QString is not const (i.e., const QString) or const&amp;
1355(i.e., const QString&amp;), then the non-const overload of operator[]
1356will be used instead.
1357
1358<h3 class=fn><a href="qcharref.html">QCharRef</a> <a name="operator[]-2"></a>QString::operator[] ( int&nbsp;i )
1359</h3>
1360
1361<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1362<p> The function returns a reference to the character at index <em>i</em>.
1363The resulting reference can then be assigned to, or used
1364immediately, but it will become invalid once further modifications
1365are made to the original string.
1366<p> If <em>i</em> is beyond the length of the string then the string is
1367expanded with QChar::nulls, so that the <a href="qcharref.html">QCharRef</a> references a
1368valid (null) character in the string.
1369<p> The QCharRef internal class can be used much like a constant
1370<a href="qchar.html">QChar</a>, but if you assign to it, you change the original string
1371(which will detach itself because of QString's copy-on-write
1372semantics). You will get compilation errors if you try to use the
1373result as anything but a QChar.
1374
1375<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="prepend"></a>QString::prepend ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
1376</h3>
1377
1378<p> Inserts <em>s</em> at the beginning of the string and returns a
1379reference to the string.
1380<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
1381<p> <pre>
1382 QString string = "42";
1383 string.<a href="#prepend">prepend</a>( "The answer is " );
1384 // string == "The answer is 42"
1385 </pre>
1386
1387<p> <p>See also <a href="#insert">insert</a>().
1388
1389<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="prepend-2"></a>QString::prepend ( char&nbsp;ch )
1390</h3>
1391
1392<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1393<p> Inserts <em>ch</em> at the beginning of the string and returns a
1394reference to the string.
1395<p> Equivalent to <a href="#insert">insert</a>(0, <em>ch</em>).
1396<p> <p>See also <a href="#insert">insert</a>().
1397
1398<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="prepend-3"></a>QString::prepend ( <a href="qchar.html">QChar</a>&nbsp;ch )
1399</h3>
1400
1401<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1402<p> Inserts <em>ch</em> at the beginning of the string and returns a
1403reference to the string.
1404<p> Equivalent to <a href="#insert">insert</a>(0, <em>ch</em>).
1405<p> <p>See also <a href="#insert">insert</a>().
1406
1407<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="prepend-4"></a>QString::prepend ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;s )
1408</h3>
1409This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1410<p> Inserts <em>s</em> at the beginning of the string and returns a reference to the string.
1411<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
1412<p> <p>See also <a href="#insert">insert</a>().
1413
1414<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="prepend-5"></a>QString::prepend ( const&nbsp;char&nbsp;*&nbsp;s )
1415</h3>
1416This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1417<p> Inserts <em>s</em> at the beginning of the string and returns a reference to the string.
1418<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
1419<p> <p>See also <a href="#insert">insert</a>().
1420
1421<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="prepend-6"></a>QString::prepend ( const&nbsp;std::string&nbsp;&amp;&nbsp;s )
1422</h3>
1423This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1424<p> Inserts <em>s</em> at the beginning of the string and returns a reference to the string.
1425<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
1426<p> <p>See also <a href="#insert">insert</a>().
1427
1428<h3 class=fn><a href="qchar.html">QChar</a>&nbsp;&amp; <a name="ref"></a>QString::ref ( uint&nbsp;i )
1429</h3>
1430
1431<p> Returns the <a href="qchar.html">QChar</a> at index <em>i</em> by reference, expanding the string
1432with QChar::null if necessary. The resulting reference can be
1433assigned to, or otherwise used immediately, but becomes invalid
1434once furher modifications are made to the string.
1435<p> <pre>
1436 QString string("ABCDEF");
1437 <a href="qchar.html">QChar</a> ch = string.<a href="#ref">ref</a>( 3 ); // ch == 'D'
1438 </pre>
1439
1440<p> <p>See also <a href="#constref">constref</a>().
1441
1442<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="remove"></a>QString::remove ( uint&nbsp;index, uint&nbsp;len )
1443</h3>
1444Removes <em>len</em> characters from the string starting at position <em>index</em>, and returns a reference to the string.
1445<p> If <em>index</em> is beyond the length of the string, nothing happens.
1446If <em>index</em> is within the string, but <em>index</em> + <em>len</em> is beyond
1447the end of the string, the string is truncated at position <em>index</em>.
1448<p> <pre>
1449 QString string( "Montreal" );
1450 string.<a href="#remove">remove</a>( 1, 4 ); // string == "Meal"
1451 </pre>
1452
1453<p> <p>See also <a href="#insert">insert</a>() and <a href="#replace">replace</a>().
1454
1455<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="remove-2"></a>QString::remove ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str, bool&nbsp;cs = TRUE )
1456</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1457<p> Removes every occurrence of <em>str</em> in the string. Returns a
1458reference to the string.
1459<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
1460otherwise the search is case insensitive.
1461<p> This is the same as <a href="#replace">replace</a>(<em>str</em>, "", <em>cs</em>).
1462
1463<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="remove-3"></a>QString::remove ( <a href="qchar.html">QChar</a>&nbsp;c )
1464</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1465<p> Removes every occurrence of the character <em>c</em> in the string.
1466Returns a reference to the string.
1467<p> This is the same as <a href="#replace">replace</a>(<em>c</em>, "").
1468
1469<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="remove-4"></a>QString::remove ( char&nbsp;c )
1470</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1471<p>
1472<p> Removes every occurrence of the character <em>c</em> in the string.
1473Returns a reference to the string.
1474<p> This is the same as <a href="#replace">replace</a>(<em>c</em>, "").
1475
1476<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="remove-5"></a>QString::remove ( const&nbsp;char&nbsp;*&nbsp;str )
1477</h3>
1478This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1479<p> Removes every occurrence of <em>str</em> in the string. Returns a
1480reference to the string.
1481
1482<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="remove-6"></a>QString::remove ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx )
1483</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1484<p> Removes every occurrence of the <a href="qregexp.html#regular-expression">regular expression</a> <em>rx</em> in the
1485string. Returns a reference to the string.
1486<p> This is the same as <a href="#replace">replace</a>(<em>rx</em>, "").
1487
1488<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace"></a>QString::replace ( uint&nbsp;index, uint&nbsp;len, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
1489</h3>
1490Replaces <em>len</em> characters from the string with <em>s</em>, starting at
1491position <em>index</em>, and returns a reference to the string.
1492<p> If <em>index</em> is beyond the length of the string, nothing is deleted
1493and <em>s</em> is appended at the end of the string. If <em>index</em> is
1494valid, but <em>index</em> + <em>len</em> is beyond the end of the string,
1495the string is truncated at position <em>index</em>, then <em>s</em> is
1496appended at the end.
1497<p> <pre>
1498 QString string( "Say yes!" );
1499 string = string.<a href="#replace">replace</a>( 4, 3, "NO" );
1500 // string == "Say NO!"
1501 </pre>
1502
1503<p> <b>Warning:</b> Qt 3.3.3 and earlier had different semantics for the
1504case <em>index</em> >= <a href="#length">length</a>(), which contradicted the documentation.
1505To avoid portability problems between Qt 3 versions and with Qt
15064, we recommend that you never call the function with <em>index</em> >=
1507length().
1508<p> <p>See also <a href="#insert">insert</a>() and <a href="#remove">remove</a>().
1509
1510<p>Examples: <a href="listviews-example.html#x162">listviews/listviews.cpp</a>, <a href="networkprotocol-example.html#x694">network/networkprotocol/nntp.cpp</a>, <a href="qmag-example.html#x1794">qmag/qmag.cpp</a>, and <a href="regexptester-example.html#x2497">regexptester/regexptester.cpp</a>.
1511<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-2"></a>QString::replace ( uint&nbsp;index, uint&nbsp;len, const&nbsp;<a href="qchar.html">QChar</a>&nbsp;*&nbsp;s, uint&nbsp;slen )
1512</h3>
1513This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1514<p> Replaces <em>len</em> characters with <em>slen</em> characters of <a href="qchar.html">QChar</a> data
1515from <em>s</em>, starting at position <em>index</em>, and returns a reference
1516to the string.
1517<p> <p>See also <a href="#insert">insert</a>() and <a href="#remove">remove</a>().
1518
1519<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-3"></a>QString::replace ( uint&nbsp;index, uint&nbsp;len, <a href="qchar.html">QChar</a>&nbsp;c )
1520</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1521<p> This is the same as <a href="#replace">replace</a>(<em>index</em>, <em>len</em>, QString(<em>c</em>)).
1522
1523<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-4"></a>QString::replace ( uint&nbsp;index, uint&nbsp;len, char&nbsp;c )
1524</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1525<p>
1526<p> This is the same as <a href="#replace">replace</a>(<em>index</em>, <em>len</em>, <a href="qchar.html">QChar</a>(<em>c</em>)).
1527
1528<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-5"></a>QString::replace ( <a href="qchar.html">QChar</a>&nbsp;c, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;after, bool&nbsp;cs = TRUE )
1529</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1530<p> Replaces every occurrence of the character <em>c</em> in the string
1531with <em>after</em>. Returns a reference to the string.
1532<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
1533otherwise the search is case insensitive.
1534<p> Example:
1535<pre>
1536 QString s = "a,b,c";
1537 s.<a href="#replace">replace</a>( QChar(','), " or " );
1538 // s == "a or b or c"
1539 </pre>
1540
1541
1542<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-6"></a>QString::replace ( char&nbsp;c, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;after, bool&nbsp;cs = TRUE )
1543</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1544<p>
1545<p> Replaces every occurrence of the character <em>c</em> in the string
1546with <em>after</em>. Returns a reference to the string.
1547<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
1548otherwise the search is case insensitive.
1549
1550<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-7"></a>QString::replace ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;before, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;after, bool&nbsp;cs = TRUE )
1551</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1552<p> Replaces every occurrence of the string <em>before</em> in the string
1553with the string <em>after</em>. Returns a reference to the string.
1554<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
1555otherwise the search is case insensitive.
1556<p> Example:
1557<pre>
1558 QString s = "Greek is Greek";
1559 s.<a href="#replace">replace</a>( "Greek", "English" );
1560 // s == "English is English"
1561 </pre>
1562
1563
1564<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-8"></a>QString::replace ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;after )
1565</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1566<p> Replaces every occurrence of the regexp <em>rx</em> in the string with
1567<em>after</em>. Returns a reference to the string. For example:
1568<pre>
1569 QString s = "banana";
1570 s.<a href="#replace">replace</a>( QRegExp("an"), "" );
1571 // s == "ba"
1572 </pre>
1573
1574<p> For regexps containing <a href="qregexp.html#capturing-text">capturing
1575 parentheses</a>, occurrences of <b>&#92;1</b>, <b>&#92;2</b>, ...,
1576in <em>after</em> are replaced with <em>rx</em>.cap(1), cap(2), ...
1577<p> <pre>
1578 QString t = "A &lt;i&gt;bon mot&lt;/i&gt;.";
1579 t.<a href="#replace">replace</a>( QRegExp("&lt;i&gt;([^&lt;]*)&lt;/i&gt;"), "\\emph{\\1}" );
1580 // t == "A \\emph{bon mot}."
1581 </pre>
1582
1583<p> <p>See also <a href="#find">find</a>(), <a href="#findRev">findRev</a>(), and <a href="qregexp.html#cap">QRegExp::cap</a>().
1584
1585<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="replace-9"></a>QString::replace ( <a href="qchar.html">QChar</a>&nbsp;c1, <a href="qchar.html">QChar</a>&nbsp;c2 )
1586</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1587<p> Replaces every occurrence of <em>c1</em> with the char <em>c2</em>. Returns a
1588reference to the string.
1589
1590<h3 class=fn>void <a name="reserve"></a>QString::reserve ( uint&nbsp;minCapacity )
1591</h3>
1592Ensures that at least <em>minCapacity</em> characters are allocated to
1593the string.
1594<p> This function is useful for code that needs to build up a long
1595string and wants to avoid repeated reallocation. In this example,
1596we want to add to the string until some condition is true, and
1597we're fairly sure that size is big enough:
1598<pre>
1599 QString result;
1600 int len = 0;
1601 result.<a href="#reserve">reserve</a>(maxLen);
1602 while (...) {
1603 result[len++] = ... // fill part of the space
1604 }
1605 result.<a href="#squeeze">squeeze</a>();
1606 </pre>
1607
1608<p> If <em>maxLen</em> is an underestimate, the worst that will happen is
1609that the loop will slow down.
1610<p> If it is not possible to allocate enough memory, the string
1611remains unchanged.
1612<p> <p>See also <a href="#capacity">capacity</a>(), <a href="#squeeze">squeeze</a>(), and <a href="#setLength">setLength</a>().
1613
1614<h3 class=fn><a href="qstring.html">QString</a> <a name="right"></a>QString::right ( uint&nbsp;len ) const
1615</h3>
1616Returns a string that contains the <em>len</em> rightmost characters of
1617the string.
1618<p> If <em>len</em> is greater than the length of the string then the whole
1619string is returned.
1620<p> <pre>
1621 QString string( "Pineapple" );
1622 QString t = string.<a href="#right">right</a>( 5 ); // t == "apple"
1623 </pre>
1624
1625<p> <p>See also <a href="#left">left</a>(), <a href="#mid">mid</a>(), and <a href="#isEmpty">isEmpty</a>().
1626
1627<p>Example: <a href="fileiconview-example.html#x871">fileiconview/qfileiconview.cpp</a>.
1628<h3 class=fn><a href="qstring.html">QString</a> <a name="rightJustify"></a>QString::rightJustify ( uint&nbsp;width, <a href="qchar.html">QChar</a>&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const
1629</h3>
1630Returns a string of length <em>width</em> that contains the <em>fill</em>
1631character followed by the string.
1632<p> If <em>truncate</em> is FALSE and the length of the string is more than
1633<em>width</em>, then the returned string is a copy of the string.
1634<p> If <em>truncate</em> is TRUE and the length of the string is more than
1635<em>width</em>, then the resulting string is truncated at position <em>width</em>.
1636<p> <pre>
1637 QString string( "apple" );
1638 QString t = string.<a href="#rightJustify">rightJustify</a>( 8, '.' ); // t == "...apple"
1639 </pre>
1640
1641<p> <p>See also <a href="#leftJustify">leftJustify</a>().
1642
1643<h3 class=fn><a href="qstring.html">QString</a> <a name="section"></a>QString::section ( <a href="qchar.html">QChar</a>&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const
1644</h3>
1645
1646<p> This function returns a section of the string.
1647<p> This string is treated as a sequence of fields separated by the
1648character, <em>sep</em>. The returned string consists of the fields from
1649position <em>start</em> to position <em>end</em> inclusive. If <em>end</em> is not
1650specified, all fields from position <em>start</em> to the end of the
1651string are included. Fields are numbered 0, 1, 2, etc., counting
1652from the left, and -1, -2, etc., counting from right to left.
1653<p> The <em>flags</em> argument can be used to affect some aspects of the
1654function's behaviour, e.g. whether to be case sensitive, whether
1655to skip empty fields and how to deal with leading and trailing
1656separators; see <a href="#SectionFlags-enum">SectionFlags</a>.
1657<p> <pre>
1658 QString csv( "forename,middlename,surname,phone" );
1659 QString s = csv.<a href="#section">section</a>( ',', 2, 2 ); // s == "surname"
1660
1661 QString path( "/usr/local/bin/myapp" ); // First field is empty
1662 QString s = path.<a href="#section">section</a>( '/', 3, 4 ); // s == "bin/myapp"
1663 QString s = path.<a href="#section">section</a>( '/', 3, 3, SectionSkipEmpty ); // s == "myapp"
1664 </pre>
1665
1666<p> If <em>start</em> or <em>end</em> is negative, we count fields from the right
1667of the string, the right-most field being -1, the one from
1668right-most field being -2, and so on.
1669<p> <pre>
1670 QString csv( "forename,middlename,surname,phone" );
1671 QString s = csv.<a href="#section">section</a>( ',', -3, -2 ); // s == "middlename,surname"
1672
1673 QString path( "/usr/local/bin/myapp" ); // First field is empty
1674 QString s = path.<a href="#section">section</a>( '/', -1 ); // s == "myapp"
1675 </pre>
1676
1677<p> <p>See also <a href="qstringlist.html#split">QStringList::split</a>().
1678
1679<p>Examples: <a href="tutorial2-03.html#x2551">chart/element.cpp</a> and <a href="ftpclient-example.html#x772">network/ftpclient/ftpmainwindow.ui.h</a>.
1680<h3 class=fn><a href="qstring.html">QString</a> <a name="section-2"></a>QString::section ( char&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const
1681</h3>
1682
1683<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1684<p>
1685<h3 class=fn><a href="qstring.html">QString</a> <a name="section-3"></a>QString::section ( const&nbsp;char&nbsp;*&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const
1686</h3>
1687
1688<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1689<p>
1690<h3 class=fn><a href="qstring.html">QString</a> <a name="section-4"></a>QString::section ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;sep, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const
1691</h3>
1692This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1693<p> This function returns a section of the string.
1694<p> This string is treated as a sequence of fields separated by the
1695string, <em>sep</em>. The returned string consists of the fields from
1696position <em>start</em> to position <em>end</em> inclusive. If <em>end</em> is not
1697specified, all fields from position <em>start</em> to the end of the
1698string are included. Fields are numbered 0, 1, 2, etc., counting
1699from the left, and -1, -2, etc., counting from right to left.
1700<p> The <em>flags</em> argument can be used to affect some aspects of the
1701function's behaviour, e.g. whether to be case sensitive, whether
1702to skip empty fields and how to deal with leading and trailing
1703separators; see <a href="#SectionFlags-enum">SectionFlags</a>.
1704<p> <pre>
1705 QString data( "forename**middlename**surname**phone" );
1706 QString s = data.<a href="#section">section</a>( "**", 2, 2 ); // s == "surname"
1707 </pre>
1708
1709<p> If <em>start</em> or <em>end</em> is negative, we count fields from the right
1710of the string, the right-most field being -1, the one from
1711right-most field being -2, and so on.
1712<p> <pre>
1713 QString data( "forename**middlename**surname**phone" );
1714 QString s = data.<a href="#section">section</a>( "**", -3, -2 ); // s == "middlename**surname"
1715 </pre>
1716
1717<p> <p>See also <a href="qstringlist.html#split">QStringList::split</a>().
1718
1719<h3 class=fn><a href="qstring.html">QString</a> <a name="section-5"></a>QString::section ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;reg, int&nbsp;start, int&nbsp;end = 0xffffffff, int&nbsp;flags = SectionDefault ) const
1720</h3>
1721This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1722<p> This function returns a section of the string.
1723<p> This string is treated as a sequence of fields separated by the
1724<a href="qregexp.html#regular-expression">regular expression</a>, <em>reg</em>. The returned string consists of the
1725fields from position <em>start</em> to position <em>end</em> inclusive. If <em>end</em> is not specified, all fields from position <em>start</em> to the end
1726of the string are included. Fields are numbered 0, 1, 2, etc., counting
1727from the left, and -1, -2, etc., counting from right to left.
1728<p> The <em>flags</em> argument can be used to affect some aspects of the
1729function's behaviour, e.g. whether to be case sensitive, whether
1730to skip empty fields and how to deal with leading and trailing
1731separators; see <a href="#SectionFlags-enum">SectionFlags</a>.
1732<p> <pre>
1733 QString line( "forename\tmiddlename surname \t \t phone" );
1734 <a href="qregexp.html">QRegExp</a> sep( "\s+" );
1735 QString s = line.<a href="#section">section</a>( sep, 2, 2 ); // s == "surname"
1736 </pre>
1737
1738<p> If <em>start</em> or <em>end</em> is negative, we count fields from the right
1739of the string, the right-most field being -1, the one from
1740right-most field being -2, and so on.
1741<p> <pre>
1742 QString line( "forename\tmiddlename surname \t \t phone" );
1743 <a href="qregexp.html">QRegExp</a> sep( "\\s+" );
1744 QString s = line.<a href="#section">section</a>( sep, -3, -2 ); // s == "middlename surname"
1745 </pre>
1746
1747<p> <b>Warning:</b> Using this <a href="qregexp.html">QRegExp</a> version is much more expensive than
1748the overloaded string and character versions.
1749<p> <p>See also <a href="qstringlist.html#split">QStringList::split</a>() and <a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>().
1750
1751<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setAscii"></a>QString::setAscii ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;len = -1 )
1752</h3>
1753Sets this string to <em>str</em>, interpreted as a classic 8-bit ASCII C
1754string. If <em>len</em> is -1 (the default), then it is set to
1755strlen(str).
1756<p> If <em>str</em> is 0 a null string is created. If <em>str</em> is "", an empty
1757string is created.
1758<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
1759
1760<h3 class=fn>void <a name="setExpand"></a>QString::setExpand ( uint&nbsp;index, <a href="qchar.html">QChar</a>&nbsp;c )
1761</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1762<p> Sets the character at position <em>index</em> to <em>c</em> and expands the
1763string if necessary, filling with spaces.
1764<p> This method is redundant in Qt 3.x, because operator[] will expand
1765the string as necessary.
1766
1767<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setLatin1"></a>QString::setLatin1 ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;len = -1 )
1768</h3>
1769Sets this string to <em>str</em>, interpreted as a classic Latin-1 C
1770string. If <em>len</em> is -1 (the default), then it is set to
1771strlen(str).
1772<p> If <em>str</em> is 0 a null string is created. If <em>str</em> is "", an empty
1773string is created.
1774<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
1775
1776<h3 class=fn>void <a name="setLength"></a>QString::setLength ( uint&nbsp;newLen )
1777</h3>
1778Ensures that at least <em>newLen</em> characters are allocated to the
1779string, and sets the length of the string to <em>newLen</em>. Any new
1780space allocated contains arbitrary data.
1781<p> <p>See also <a href="#reserve">reserve</a>() and <a href="#truncate">truncate</a>().
1782
1783<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum"></a>QString::setNum ( Q_LLONG&nbsp;n, int&nbsp;base = 10 )
1784</h3>
1785Sets the string to the printed value of <em>n</em> in base <em>base</em> and
1786returns a reference to the string. The returned string is in "C" locale.
1787<p> The base is 10 by default and must be between 2 and 36.
1788<p> <pre>
1789 QString string;
1790 string = string.<a href="#setNum">setNum</a>( 1234 ); // string == "1234"
1791 </pre>
1792
1793
1794<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-2"></a>QString::setNum ( short&nbsp;n, int&nbsp;base = 10 )
1795</h3>
1796
1797<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1798<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
1799returns a reference to the string.
1800<p> The base is 10 by default and must be between 2 and 36.
1801
1802<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-3"></a>QString::setNum ( ushort&nbsp;n, int&nbsp;base = 10 )
1803</h3>
1804
1805<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1806<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
1807returns a reference to the string.
1808<p> The base is 10 by default and must be between 2 and 36.
1809
1810<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-4"></a>QString::setNum ( int&nbsp;n, int&nbsp;base = 10 )
1811</h3>
1812
1813<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1814<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
1815returns a reference to the string.
1816<p> The base is 10 by default and must be between 2 and 36.
1817
1818<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-5"></a>QString::setNum ( uint&nbsp;n, int&nbsp;base = 10 )
1819</h3>
1820
1821<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1822<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
1823returns a reference to the string.
1824<p> The base is 10 by default and must be between 2 and 36.
1825
1826<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-6"></a>QString::setNum ( long&nbsp;n, int&nbsp;base = 10 )
1827</h3>
1828
1829<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1830<p>
1831<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-7"></a>QString::setNum ( ulong&nbsp;n, int&nbsp;base = 10 )
1832</h3>
1833
1834<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1835<p>
1836<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-8"></a>QString::setNum ( Q_ULLONG&nbsp;n, int&nbsp;base = 10 )
1837</h3>
1838This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1839<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
1840returns a reference to the string.
1841<p> The base is 10 by default and must be between 2 and 36.
1842
1843<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-9"></a>QString::setNum ( float&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )
1844</h3>
1845
1846<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1847<p> Sets the string to the printed value of <em>n</em>, formatted in format
1848<em>f</em> with precision <em>prec</em>, and returns a reference to the
1849string.
1850<p> The format <em>f</em> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See <a href="#arg-formats">arg</a>() for an explanation of the formats.
1851
1852<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setNum-a"></a>QString::setNum ( double&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )
1853</h3>
1854This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1855<p> Sets the string to the printed value of <em>n</em>, formatted in format
1856<em>f</em> with precision <em>prec</em>, and returns a reference to the
1857string.
1858<p> The format <em>f</em> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See <a href="#arg-formats">arg</a>() for an explanation of the formats.
1859
1860<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setUnicode"></a>QString::setUnicode ( const&nbsp;<a href="qchar.html">QChar</a>&nbsp;*&nbsp;unicode, uint&nbsp;len )
1861</h3>
1862Resizes the string to <em>len</em> characters and copies <em>unicode</em> into
1863the string. If <em>unicode</em> is 0, nothing is copied, but the
1864string is still resized to <em>len</em>. If <em>len</em> is zero, then the
1865string becomes a <a href="#isNull">null</a> string.
1866<p> <p>See also <a href="#setLatin1">setLatin1</a>() and <a href="#isNull">isNull</a>().
1867
1868<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="setUnicodeCodes"></a>QString::setUnicodeCodes ( const&nbsp;ushort&nbsp;*&nbsp;unicode_as_ushorts, uint&nbsp;len )
1869</h3>
1870Resizes the string to <em>len</em> characters and copies <em>unicode_as_ushorts</em> into the string (on some X11 client platforms
1871this will involve a byte-swapping pass).
1872<p> If <em>unicode_as_ushorts</em> is 0, nothing is copied, but the string
1873is still resized to <em>len</em>. If <em>len</em> is zero, the string becomes
1874a <a href="#isNull">null</a> string.
1875<p> <p>See also <a href="#setLatin1">setLatin1</a>() and <a href="#isNull">isNull</a>().
1876
1877<h3 class=fn><a href="qstring.html">QString</a> <a name="simplifyWhiteSpace"></a>QString::simplifyWhiteSpace () const
1878</h3>
1879Returns a string that has whitespace removed from the start and
1880the end, and which has each sequence of internal whitespace
1881replaced with a single space.
1882<p> Whitespace means any character for which <a href="qchar.html#isSpace">QChar::isSpace</a>() returns
1883TRUE. This includes Unicode characters with decimal values 9
1884(TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR), and 32 (Space).
1885<p> <pre>
1886 QString string = " lots\t of\nwhite space ";
1887 QString t = string.<a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>();
1888 // t == "lots of white space"
1889 </pre>
1890
1891<p> <p>See also <a href="#stripWhiteSpace">stripWhiteSpace</a>().
1892
1893<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="sprintf"></a>QString::sprintf ( const&nbsp;char&nbsp;*&nbsp;cformat, ... )
1894</h3>
1895Safely builds a formatted string from the format string <em>cformat</em>
1896and an arbitrary list of arguments. The format string supports all
1897the escape sequences of printf() in the standard C library.
1898<p> The %s escape sequence expects a <a href="#utf8">utf8</a>() encoded string. The format
1899string <em>cformat</em> is expected to be in latin1. If you need a
1900Unicode format string, use <a href="#arg">arg</a>() instead. For typesafe string
1901building, with full Unicode support, you can use <a href="qtextostream.html">QTextOStream</a> like
1902this:
1903<p> <pre>
1904 QString str;
1905 QString s = ...;
1906 int x = ...;
1907 QTextOStream( &amp;str ) &lt;&lt; s &lt;&lt; " : " &lt;&lt; x;
1908 </pre>
1909
1910<p> For <a href="qobject.html#tr">translations,</a> especially if the
1911strings contains more than one escape sequence, you should
1912consider using the arg() function instead. This allows the order
1913of the replacements to be controlled by the translator, and has
1914Unicode support.
1915<p> The %lc escape sequence expects a unicode character of type ushort
1916(as returned by <a href="qchar.html#unicode">QChar::unicode</a>()).
1917The %ls escape sequence expects a pointer to a zero-terminated
1918array of unicode characters of type ushort (as returned by
1919<a href="#ucs2">QString::ucs2</a>()).
1920<p> <p>See also <a href="#arg">arg</a>().
1921
1922<p>Examples: <a href="dclock-example.html#x1103">dclock/dclock.cpp</a>, <a href="forever-example.html#x1052">forever/forever.cpp</a>, <a href="layout-example.html#x542">layout/layout.cpp</a>, <a href="qmag-example.html#x1795">qmag/qmag.cpp</a>, <a href="scrollview-example.html#x656">scrollview/scrollview.cpp</a>, <a href="tooltip-example.html#x449">tooltip/tooltip.cpp</a>, and <a href="xform-example.html#x1265">xform/xform.cpp</a>.
1923<h3 class=fn>void <a name="squeeze"></a>QString::squeeze ()
1924</h3>
1925Squeezes the string's capacity to the current content.
1926<p> <p>See also <a href="#capacity">capacity</a>() and <a href="#reserve">reserve</a>().
1927
1928<h3 class=fn>bool <a name="startsWith"></a>QString::startsWith ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, bool&nbsp;cs = TRUE ) const
1929</h3>
1930Returns TRUE if the string starts with <em>s</em>; otherwise returns
1931FALSE.
1932<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
1933otherwise the search is case insensitive.
1934<p> <pre>
1935 QString str( "Bananas" );
1936 str.<a href="#startsWith">startsWith</a>( "Ban" ); // returns TRUE
1937 str.<a href="#startsWith">startsWith</a>( "Car" ); // returns FALSE
1938 </pre>
1939
1940<p> <p>See also <a href="#endsWith">endsWith</a>().
1941
1942<h3 class=fn><a href="qstring.html">QString</a> <a name="stripWhiteSpace"></a>QString::stripWhiteSpace () const
1943</h3>
1944Returns a string that has whitespace removed from the start and
1945the end.
1946<p> Whitespace means any character for which <a href="qchar.html#isSpace">QChar::isSpace</a>() returns
1947TRUE. This includes Unicode characters with decimal values 9
1948(TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR) and 32 (Space), and may
1949also include other Unicode characters.
1950<p> <pre>
1951 QString string = " white space ";
1952 QString s = string.<a href="#stripWhiteSpace">stripWhiteSpace</a>(); // s == "white space"
1953 </pre>
1954
1955<p> <p>See also <a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>().
1956
1957<h3 class=fn>double <a name="toDouble"></a>QString::toDouble ( bool&nbsp;*&nbsp;ok = 0 ) const
1958</h3>
1959Returns the string converted to a <tt>double</tt> value.
1960<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
1961FALSE; otherwise <em>*ok</em> is set to TRUE.
1962<p> <pre>
1963 QString string( "1234.56" );
1964 double a = string.<a href="#toDouble">toDouble</a>(); // a == 1234.56
1965 </pre>
1966
1967<p> The string-to-number functions:
1968<ul>
1969<li> <a href="#toShort">toShort</a>()
1970<li> <a href="#toUShort">toUShort</a>()
1971<li> <a href="#toInt">toInt</a>()
1972<li> <a href="#toUInt">toUInt</a>()
1973<li> <a href="#toLong">toLong</a>()
1974<li> <a href="#toULong">toULong</a>()
1975<li> <a href="#toLongLong">toLongLong</a>()
1976<li> <a href="#toULongLong">toULongLong</a>()
1977<li> <a href="#toFloat">toFloat</a>()
1978<li> <a href="#toDouble">toDouble</a>()
1979</ul>
1980can handle numbers
1981represented in various locales. These representations may use different
1982characters for the decimal point, thousands group sepearator
1983and even individual digits. QString's functions try to interpret
1984the string according to the current locale. The current locale is
1985determined from the system at application startup and can be changed
1986by calling <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). If the string cannot be interpreted
1987according to the current locale, this function falls back
1988on the "C" locale.
1989<p> <pre>
1990 bool ok;
1991 double d;
1992
1993 QLocale::<a href="qlocale.html#setDefault">setDefault</a>(QLocale::C);
1994 d = <a href="#QString">QString</a>( "1234,56" ).toDouble(&amp;ok); // ok == false
1995 d = <a href="#QString">QString</a>( "1234.56" ).toDouble(&amp;ok); // ok == true, d == 1234.56
1996
1997 QLocale::<a href="qlocale.html#setDefault">setDefault</a>(QLocale::German);
1998 d = <a href="#QString">QString</a>( "1234,56" ).toDouble(&amp;ok); // ok == true, d == 1234.56
1999 d = <a href="#QString">QString</a>( "1234.56" ).toDouble(&amp;ok); // ok == true, d == 1234.56
2000 </pre>
2001
2002<p> Due to the ambiguity between the decimal point and thousands group
2003separator in various locales, these functions do not handle
2004thousands group separators. If you need to convert such numbers,
2005use the corresponding function in <a href="qlocale.html">QLocale</a>.
2006<p> <pre>
2007 bool ok;
2008 QLocale::<a href="qlocale.html#setDefault">setDefault</a>(QLocale::C);
2009 double d = <a href="#QString">QString</a>( "1,234,567.89" ).toDouble(&amp;ok); // ok == false
2010 </pre>
2011
2012<p> <b>Warning:</b> If the string contains trailing whitespace this function
2013will fail, and set <em>*ok</em> to false if <em>ok</em> is not 0. Leading
2014whitespace is ignored.
2015<p> <p>See also <a href="#number">number</a>(), <a href="qlocale.html#setDefault">QLocale::setDefault</a>(), <a href="qlocale.html#toDouble">QLocale::toDouble</a>(), and <a href="#stripWhiteSpace">stripWhiteSpace</a>().
2016
2017<h3 class=fn>float <a name="toFloat"></a>QString::toFloat ( bool&nbsp;*&nbsp;ok = 0 ) const
2018</h3>
2019Returns the string converted to a <tt>float</tt> value.
2020<p> Returns 0.0 if the conversion fails.
2021<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2022FALSE; otherwise <em>*ok</em> is set to TRUE.
2023<p> For information on how string-to-number functions in QString handle
2024localized input, see <a href="#toDouble">toDouble</a>().
2025<p> <b>Warning:</b> If the string contains trailing whitespace this function
2026will fail, settings <em>*ok</em> to false if <em>ok</em> is not 0.
2027Leading whitespace is ignored.
2028<p> <p>See also <a href="#number">number</a>().
2029
2030<h3 class=fn>int <a name="toInt"></a>QString::toInt ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2031</h3>
2032Returns the string converted to an <tt>int</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2033<em>base</em> is 0, the base is determined automatically using the
2034following rules:
2035<ul>
2036<li>If the string begins with "0x", it is assumed to
2037be hexadecimal;
2038<li>If it begins with "0", it is assumed to be octal;
2039<li>Otherwise it is assumed to be decimal.
2040</ul>
2041<p> Returns 0 if the conversion fails.
2042<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2043FALSE; otherwise <em>*ok</em> is set to TRUE.
2044<p> <pre>
2045 QString str( "FF" );
2046 bool ok;
2047 int hex = str.<a href="#toInt">toInt</a>( &amp;ok, 16 ); // hex == 255, ok == TRUE
2048 int dec = str.<a href="#toInt">toInt</a>( &amp;ok, 10 ); // dec == 0, ok == FALSE
2049 </pre>
2050
2051<p> Leading and trailing whitespace is ignored by this function.
2052<p> For information on how string-to-number functions in QString handle
2053localized input, see <a href="#toDouble">toDouble</a>().
2054<p> <p>See also <a href="#number">number</a>().
2055
2056<h3 class=fn>long <a name="toLong"></a>QString::toLong ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2057</h3>
2058Returns the string converted to a <tt>long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2059<em>base</em> is 0, the base is determined automatically using the
2060following rules:
2061<ul>
2062<li>If the string begins with "0x", it is assumed to
2063be hexadecimal;
2064<li>If it begins with "0", it is assumed to be octal;
2065<li>Otherwise it is assumed to be decimal.
2066</ul>
2067<p> Returns 0 if the conversion fails.
2068<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2069FALSE; otherwise <em>*ok</em> is set to TRUE.
2070<p> Leading and trailing whitespace is ignored by this function.
2071<p> For information on how string-to-number functions in QString handle
2072localized input, see <a href="#toDouble">toDouble</a>().
2073<p> <p>See also <a href="#number">number</a>().
2074
2075<h3 class=fn>Q_LLONG <a name="toLongLong"></a>QString::toLongLong ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2076</h3>
2077Returns the string converted to a <tt>long long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2078<em>base</em> is 0, the base is determined automatically using the
2079following rules:
2080<ul>
2081<li>If the string begins with "0x", it is assumed to
2082be hexadecimal;
2083<li>If it begins with "0", it is assumed to be octal;
2084<li>Otherwise it is assumed to be decimal.
2085</ul>
2086<p> Returns 0 if the conversion fails.
2087<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2088FALSE; otherwise <em>*ok</em> is set to TRUE.
2089<p> Leading and trailing whitespace is ignored by this function.
2090<p> For information on how string-to-number functions in QString handle
2091localized input, see <a href="#toDouble">toDouble</a>().
2092<p> <p>See also <a href="#number">number</a>().
2093
2094<h3 class=fn>short <a name="toShort"></a>QString::toShort ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2095</h3>
2096Returns the string converted to a <tt>short</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2097<em>base</em> is 0, the base is determined automatically using the
2098following rules:
2099<ul>
2100<li>If the string begins with "0x", it is assumed to
2101be hexadecimal;
2102<li>If it begins with "0", it is assumed to be octal;
2103<li>Otherwise it is assumed to be decimal.
2104</ul>
2105<p> Returns 0 if the conversion fails.
2106<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2107FALSE; otherwise <em>*ok</em> is set to TRUE.
2108<p> Leading and trailing whitespace is ignored by this function.
2109<p> For information on how string-to-number functions in QString handle
2110localized input, see <a href="#toDouble">toDouble</a>().
2111<p> <p>See also <a href="#number">number</a>().
2112
2113<h3 class=fn>uint <a name="toUInt"></a>QString::toUInt ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2114</h3>
2115Returns the string converted to an <tt>unsigned int</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2116<em>base</em> is 0, the base is determined automatically using the
2117following rules:
2118<ul>
2119<li>If the string begins with "0x", it is assumed to
2120be hexadecimal;
2121<li>If it begins with "0", it is assumed to be octal;
2122<li>Otherwise it is assumed to be decimal.
2123</ul>
2124<p> Returns 0 if the conversion fails.
2125<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2126FALSE; otherwise <em>*ok</em> is set to TRUE.
2127<p> Leading and trailing whitespace is ignored by this function.
2128<p> For information on how string-to-number functions in QString handle
2129localized input, see <a href="#toDouble">toDouble</a>().
2130<p> <p>See also <a href="#number">number</a>().
2131
2132<h3 class=fn>ulong <a name="toULong"></a>QString::toULong ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2133</h3>
2134Returns the string converted to an <tt>unsigned long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2135<em>base</em> is 0, the base is determined automatically using the
2136following rules:
2137<ul>
2138<li>If the string begins with "0x", it is assumed to
2139be hexadecimal;
2140<li>If it begins with "0", it is assumed to be octal;
2141<li>Otherwise it is assumed to be decimal.
2142</ul>
2143<p> Returns 0 if the conversion fails.
2144<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2145FALSE; otherwise <em>*ok</em> is set to TRUE.
2146<p> Leading and trailing whitespace is ignored by this function.
2147<p> For information on how string-to-number functions in QString handle
2148localized input, see <a href="#toDouble">toDouble</a>().
2149<p> <p>See also <a href="#number">number</a>().
2150
2151<h3 class=fn>Q_ULLONG <a name="toULongLong"></a>QString::toULongLong ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2152</h3>
2153Returns the string converted to an <tt>unsigned long long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2154<em>base</em> is 0, the base is determined automatically using the
2155following rules:
2156<ul>
2157<li>If the string begins with "0x", it is assumed to
2158be hexadecimal;
2159<li>If it begins with "0", it is assumed to be octal;
2160<li>Otherwise it is assumed to be decimal.
2161</ul>
2162<p> Returns 0 if the conversion fails.
2163<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2164FALSE; otherwise <em>*ok</em> is set to TRUE.
2165<p> Leading and trailing whitespace is ignored by this function.
2166<p> For information on how string-to-number functions in QString handle
2167localized input, see <a href="#toDouble">toDouble</a>().
2168<p> <p>See also <a href="#number">number</a>().
2169
2170<h3 class=fn>ushort <a name="toUShort"></a>QString::toUShort ( bool&nbsp;*&nbsp;ok = 0, int&nbsp;base = 10 ) const
2171</h3>
2172Returns the string converted to an <tt>unsigned short</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
2173<em>base</em> is 0, the base is determined automatically using the
2174following rules:
2175<ul>
2176<li>If the string begins with "0x", it is assumed to
2177be hexadecimal;
2178<li>If it begins with "0", it is assumed to be octal;
2179<li>Otherwise it is assumed to be decimal.
2180</ul>
2181<p> Returns 0 if the conversion fails.
2182<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
2183FALSE; otherwise <em>*ok</em> is set to TRUE.
2184<p> Leading and trailing whitespace is ignored by this function.
2185<p> For information on how string-to-number functions in QString handle
2186localized input, see <a href="#toDouble">toDouble</a>().
2187<p> <p>See also <a href="#number">number</a>().
2188
2189<h3 class=fn>void <a name="truncate"></a>QString::truncate ( uint&nbsp;newLen )
2190</h3>
2191If <em>newLen</em> is less than the length of the string, then the
2192string is truncated at position <em>newLen</em>. Otherwise nothing
2193happens.
2194<p> <pre>
2195 QString s = "truncate me";
2196 s.<a href="#truncate">truncate</a>( 5 ); // s == "trunc"
2197 </pre>
2198
2199<p> <p>See also <a href="#setLength">setLength</a>().
2200
2201<p>Example: <a href="mail-example.html#x718">network/mail/smtp.cpp</a>.
2202<h3 class=fn>const unsigned short * <a name="ucs2"></a>QString::ucs2 () const
2203</h3>
2204Returns the QString as a zero terminated array of unsigned shorts
2205if the string is not null; otherwise returns zero.
2206<p> The result remains valid so long as one unmodified
2207copy of the source string exists.
2208
2209<p>Example: <a href="activeqt-dotnet.html#x2467">dotnet/wrapper/lib/tools.cpp</a>.
2210<h3 class=fn>const&nbsp;<a href="qchar.html">QChar</a>&nbsp;* <a name="unicode"></a>QString::unicode () const
2211</h3>
2212
2213<p> Returns the Unicode representation of the string. The result
2214remains valid until the string is modified.
2215
2216<h3 class=fn><a href="qstring.html">QString</a> <a name="upper"></a>QString::upper () const
2217</h3>
2218Returns an uppercase copy of the string.
2219<p> <pre>
2220 QString string( "TeXt" );
2221 str = string.<a href="#upper">upper</a>(); // t == "TEXT"
2222 </pre>
2223
2224<p> <p>See also <a href="#lower">lower</a>().
2225
2226<p>Examples: <a href="scribble-example.html#x942">scribble/scribble.cpp</a> and <a href="sql.html#x2240">sql/overview/custom1/main.cpp</a>.
2227<h3 class=fn><a href="qcstring.html">QCString</a> <a name="utf8"></a>QString::utf8 () const
2228</h3>
2229Returns the string encoded in UTF-8 format.
2230<p> See <a href="qtextcodec.html">QTextCodec</a> for more diverse coding/decoding of Unicode strings.
2231<p> <p>See also <a href="#fromUtf8">fromUtf8</a>(), <a href="#ascii">ascii</a>(), <a href="#latin1">latin1</a>(), and <a href="#local8Bit">local8Bit</a>().
2232
2233<p>Example: <a href="archivesearch-example.html#x483">network/archivesearch/archivedialog.ui.h</a>.
2234<hr><h2>Related Functions</h2>
2235<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2236</h3>
2237
2238<p>
2239<p> Returns TRUE if <em>s1</em> is not equal to <em>s2</em>; otherwise returns FALSE.
2240Note that a null string is not equal to a not-null empty string.
2241<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) != 0.
2242<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2243
2244<h3 class=fn>bool <a name="operator!-eq-2"></a>operator!= ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2245</h3>
2246
2247<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2248<p>
2249<p> Returns TRUE if <em>s1</em> is not equal to <em>s2</em>; otherwise returns FALSE.
2250Note that a null string is not equal to a not-null empty string.
2251<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) != 0.
2252<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2253
2254<h3 class=fn>bool <a name="operator!-eq-3"></a>operator!= ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2255</h3>
2256
2257<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2258<p>
2259<p> Returns TRUE if <em>s1</em> is not equal to <em>s2</em>; otherwise returns FALSE.
2260Note that a null string is not equal to a not-null empty string.
2261<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) != 0.
2262<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2263
2264<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a> <a name="operator+"></a>operator+ ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2265</h3>
2266
2267<p>
2268<p> Returns a string which is the result of concatenating the string
2269<em>s1</em> and the string <em>s2</em>.
2270<p> Equivalent to <em>s1</em>.<a href="#append">append</a>(<em>s2</em>).
2271
2272<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a> <a name="operator+-2"></a>operator+ ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2273</h3>
2274
2275<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2276<p>
2277<p> Returns a string which is the result of concatenating the string
2278<em>s1</em> and character <em>s2</em>.
2279<p> Equivalent to <em>s1</em>.<a href="#append">append</a>(<em>s2</em>).
2280
2281<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a> <a name="operator+-3"></a>operator+ ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2282</h3>
2283
2284<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2285<p>
2286<p> Returns a string which is the result of concatenating the
2287character <em>s1</em> and string <em>s2</em>.
2288
2289<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a> <a name="operator+-4"></a>operator+ ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, char&nbsp;c )
2290</h3>
2291
2292<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2293<p>
2294<p> Returns a string which is the result of concatenating the string
2295<em>s</em> and character <em>c</em>.
2296<p> Equivalent to <em>s</em>.<a href="#append">append</a>(<em>c</em>).
2297
2298<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a> <a name="operator+-5"></a>operator+ ( char&nbsp;c, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
2299</h3>
2300
2301<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2302<p>
2303<p> Returns a string which is the result of concatenating the
2304character <em>c</em> and string <em>s</em>.
2305<p> Equivalent to <em>s</em>.<a href="#prepend">prepend</a>(<em>c</em>).
2306
2307<h3 class=fn>bool <a name="operator-lt"></a>operator&lt; ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2308</h3>
2309
2310<p>
2311<p> Returns TRUE if <em>s1</em> is lexically less than <em>s2</em>; otherwise returns FALSE.
2312The comparison is case sensitive.
2313<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &lt; 0.
2314
2315<h3 class=fn>bool <a name="operator-lt-2"></a>operator&lt; ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2316</h3>
2317
2318<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2319<p>
2320<p> Returns TRUE if <em>s1</em> is lexically less than <em>s2</em>; otherwise returns FALSE.
2321The comparison is case sensitive.
2322<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &lt; 0.
2323
2324<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str )
2325</h3>
2326
2327<p> Writes the string <em>str</em> to the stream <em>s</em>.
2328<p> See also <a href="datastreamformat.html">Format of the QDataStream operators</a>
2329
2330<h3 class=fn>bool <a name="operator-lt-eq"></a>operator&lt;= ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2331</h3>
2332
2333<p>
2334<p> Returns TRUE if <em>s1</em> is lexically less than or equal to <em>s2</em>;
2335otherwise returns FALSE.
2336The comparison is case sensitive.
2337Note that a null string is not equal to a not-null empty string.
2338<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>,<em>s2</em>) &lt;= 0.
2339<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2340
2341<h3 class=fn>bool <a name="operator-lt-eq-2"></a>operator&lt;= ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2342</h3>
2343
2344<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2345<p>
2346<p> Returns TRUE if <em>s1</em> is lexically less than or equal to <em>s2</em>;
2347otherwise returns FALSE.
2348The comparison is case sensitive.
2349Note that a null string is not equal to a not-null empty string.
2350<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &lt;= 0.
2351<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2352
2353<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2354</h3>
2355
2356<p>
2357<p> Returns TRUE if <em>s1</em> is equal to <em>s2</em>; otherwise returns FALSE.
2358Note that a null string is not equal to a not-null empty string.
2359<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) == 0.
2360<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2361
2362<h3 class=fn>bool <a name="operator-eq-eq-2"></a>operator== ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2363</h3>
2364
2365<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2366<p>
2367<p> Returns TRUE if <em>s1</em> is equal to <em>s2</em>; otherwise returns FALSE.
2368Note that a null string is not equal to a not-null empty string.
2369<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) == 0.
2370<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2371
2372<h3 class=fn>bool <a name="operator-eq-eq-3"></a>operator== ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2373</h3>
2374
2375<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2376<p>
2377<p> Returns TRUE if <em>s1</em> is equal to <em>s2</em>; otherwise returns FALSE.
2378Note that a null string is not equal to a not-null empty string.
2379<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) == 0.
2380<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2381
2382<h3 class=fn>bool <a name="operator-gt"></a>operator&gt; ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2383</h3>
2384
2385<p>
2386<p> Returns TRUE if <em>s1</em> is lexically greater than <em>s2</em>; otherwise
2387returns FALSE.
2388The comparison is case sensitive.
2389<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &gt; 0.
2390
2391<h3 class=fn>bool <a name="operator-gt-2"></a>operator&gt; ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2392</h3>
2393
2394<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2395<p>
2396<p> Returns TRUE if <em>s1</em> is lexically greater than <em>s2</em>; otherwise
2397returns FALSE.
2398The comparison is case sensitive.
2399<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &gt; 0.
2400
2401<h3 class=fn>bool <a name="operator-gt-eq"></a>operator&gt;= ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
2402</h3>
2403
2404<p>
2405<p> Returns TRUE if <em>s1</em> is lexically greater than or equal to <em>s2</em>;
2406otherwise returns FALSE.
2407The comparison is case sensitive.
2408Note that a null string is not equal to a not-null empty string.
2409<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &gt;= 0.
2410<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2411
2412<h3 class=fn>bool <a name="operator-gt-eq-2"></a>operator&gt;= ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s2 )
2413</h3>
2414
2415<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
2416<p>
2417<p> Returns TRUE if <em>s1</em> is lexically greater than or equal to <em>s2</em>;
2418otherwise returns FALSE.
2419The comparison is case sensitive.
2420Note that a null string is not equal to a not-null empty string.
2421<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) &gt;= 0.
2422<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
2423
2424<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str )
2425</h3>
2426
2427<p> Reads a string from the stream <em>s</em> into string <em>str</em>.
2428<p> See also <a href="datastreamformat.html">Format of the QDataStream operators</a>
2429
2430<!-- eof -->
2431<hr><p>
2432This file is part of the <a href="index.html">Qt toolkit</a>.
2433Copyright &copy; 1995-2007
2434<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
2435<table width=100% cellspacing=0 border=0><tr>
2436<td>Copyright &copy; 2007
2437<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
2438<td align=right><div align=right>Qt 3.3.8</div>
2439</table></div></address></body>
2440</html>
Note: See TracBrowser for help on using the repository browser.