~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qstring.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/tools/qstring.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QString Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QString Class Reference</h1>
 
21
<p>The QString class provides a Unicode character string. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QString&gt;</pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
 
23
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
 
24
<ul>
 
25
<li><a href="qstring-members.html">List of all members, including inherited members</a></li>
 
26
<li><a href="qstring-qt3.html">Qt 3 support members</a></li>
 
27
</ul>
 
28
<a name="public-types"></a>
 
29
<h3>Public Types</h3>
 
30
<ul>
 
31
<li><div class="fn"/>class <b><a href="qstring-null.html">Null</a></b></li>
 
32
<li><div class="fn"/>enum <b><a href="qstring.html#NormalizationForm-enum">NormalizationForm</a></b> { NormalizationForm_D, NormalizationForm_C, NormalizationForm_KD, NormalizationForm_KC }</li>
 
33
<li><div class="fn"/>enum <b><a href="qstring.html#SectionFlag-enum">SectionFlag</a></b> { SectionDefault, SectionSkipEmpty, SectionIncludeLeadingSep, SectionIncludeTrailingSep, SectionCaseInsensitiveSeps }</li>
 
34
<li><div class="fn"/>flags <b><a href="qstring.html#SectionFlag-enum">SectionFlags</a></b></li>
 
35
<li><div class="fn"/>enum <b><a href="qstring.html#SplitBehavior-enum">SplitBehavior</a></b> { KeepEmptyParts, SkipEmptyParts }</li>
 
36
</ul>
 
37
<a name="public-functions"></a>
 
38
<h3>Public Functions</h3>
 
39
<ul>
 
40
<li><div class="fn"/><b><a href="qstring.html#QString">QString</a></b> ()</li>
 
41
<li><div class="fn"/><b><a href="qstring.html#QString-2">QString</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</li>
 
42
<li><div class="fn"/><b><a href="qstring.html#QString-3">QString</a></b> ( QChar <i>ch</i> )</li>
 
43
<li><div class="fn"/><b><a href="qstring.html#QString-4">QString</a></b> ( int <i>size</i>, QChar <i>ch</i> )</li>
 
44
<li><div class="fn"/><b><a href="qstring.html#QString-5">QString</a></b> ( const QLatin1String &amp; <i>str</i> )</li>
 
45
<li><div class="fn"/><b><a href="qstring.html#QString-6">QString</a></b> ( const QString &amp; <i>other</i> )</li>
 
46
<li><div class="fn"/><b><a href="qstring.html#QString-7">QString</a></b> ( const char * <i>str</i> )</li>
 
47
<li><div class="fn"/><b><a href="qstring.html#QString-8">QString</a></b> ( const QByteArray &amp; <i>ba</i> )</li>
 
48
<li><div class="fn"/><b><a href="qstring.html#dtor.QString">~QString</a></b> ()</li>
 
49
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#append">append</a></b> ( const QString &amp; <i>str</i> )</li>
 
50
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#append-2">append</a></b> ( const QLatin1String &amp; <i>str</i> )</li>
 
51
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#append-3">append</a></b> ( const QByteArray &amp; <i>ba</i> )</li>
 
52
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#append-4">append</a></b> ( const char * <i>str</i> )</li>
 
53
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#append-5">append</a></b> ( QChar <i>ch</i> )</li>
 
54
<li><div class="fn"/>QString <b><a href="qstring.html#arg">arg</a></b> ( const QString &amp; <i>a</i>, int <i>fieldWidth</i> = 0, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
55
<li><div class="fn"/>QString <b><a href="qstring.html#arg-2">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i> ) const</li>
 
56
<li><div class="fn"/>QString <b><a href="qstring.html#arg-3">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i> ) const</li>
 
57
<li><div class="fn"/>QString <b><a href="qstring.html#arg-4">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i> ) const</li>
 
58
<li><div class="fn"/>QString <b><a href="qstring.html#arg-5">arg</a></b> ( int <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
59
<li><div class="fn"/>QString <b><a href="qstring.html#arg-6">arg</a></b> ( uint <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
60
<li><div class="fn"/>QString <b><a href="qstring.html#arg-7">arg</a></b> ( long <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
61
<li><div class="fn"/>QString <b><a href="qstring.html#arg-8">arg</a></b> ( ulong <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
62
<li><div class="fn"/>QString <b><a href="qstring.html#arg-9">arg</a></b> ( qlonglong <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
63
<li><div class="fn"/>QString <b><a href="qstring.html#arg-10">arg</a></b> ( qulonglong <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
64
<li><div class="fn"/>QString <b><a href="qstring.html#arg-11">arg</a></b> ( short <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
65
<li><div class="fn"/>QString <b><a href="qstring.html#arg-12">arg</a></b> ( ushort <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
66
<li><div class="fn"/>QString <b><a href="qstring.html#arg-13">arg</a></b> ( QChar <i>a</i>, int <i>fieldWidth</i> = 0, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
67
<li><div class="fn"/>QString <b><a href="qstring.html#arg-14">arg</a></b> ( char <i>a</i>, int <i>fieldWidth</i> = 0, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
68
<li><div class="fn"/>QString <b><a href="qstring.html#arg-15">arg</a></b> ( double <i>a</i>, int <i>fieldWidth</i> = 0, char <i>fmt</i> = 'g', int <i>prec</i> = -1, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</li>
 
69
<li><div class="fn"/>const QChar <b><a href="qstring.html#at">at</a></b> ( int <i>i</i> ) const</li>
 
70
<li><div class="fn"/>int <b><a href="qstring.html#capacity">capacity</a></b> () const</li>
 
71
<li><div class="fn"/>void <b><a href="qstring.html#chop">chop</a></b> ( int <i>n</i> )</li>
 
72
<li><div class="fn"/>void <b><a href="qstring.html#clear">clear</a></b> ()</li>
 
73
<li><div class="fn"/>int <b><a href="qstring.html#compare-2">compare</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
74
<li><div class="fn"/>const QChar * <b><a href="qstring.html#constData">constData</a></b> () const</li>
 
75
<li><div class="fn"/>bool <b><a href="qstring.html#contains">contains</a></b> ( const QString &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
76
<li><div class="fn"/>bool <b><a href="qstring.html#contains-4">contains</a></b> ( QChar <i>ch</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
77
<li><div class="fn"/>bool <b><a href="qstring.html#contains-5">contains</a></b> ( const QRegExp &amp; <i>rx</i> ) const</li>
 
78
<li><div class="fn"/>int <b><a href="qstring.html#count">count</a></b> ( const QString &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
79
<li><div class="fn"/>int <b><a href="qstring.html#count-2">count</a></b> ( QChar <i>ch</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
80
<li><div class="fn"/>int <b><a href="qstring.html#count-3">count</a></b> ( const QRegExp &amp; <i>rx</i> ) const</li>
 
81
<li><div class="fn"/>int <b><a href="qstring.html#count-4">count</a></b> () const</li>
 
82
<li><div class="fn"/>QChar * <b><a href="qstring.html#data">data</a></b> ()</li>
 
83
<li><div class="fn"/>const QChar * <b><a href="qstring.html#data-2">data</a></b> () const</li>
 
84
<li><div class="fn"/>bool <b><a href="qstring.html#endsWith">endsWith</a></b> ( const QString &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
85
<li><div class="fn"/>bool <b><a href="qstring.html#endsWith-3">endsWith</a></b> ( const QLatin1String &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
86
<li><div class="fn"/>bool <b><a href="qstring.html#endsWith-4">endsWith</a></b> ( const QChar &amp; <i>c</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
87
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#fill">fill</a></b> ( QChar <i>ch</i>, int <i>size</i> = -1 )</li>
 
88
<li><div class="fn"/>int <b><a href="qstring.html#indexOf">indexOf</a></b> ( const QString &amp; <i>str</i>, int <i>from</i> = 0, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
89
<li><div class="fn"/>int <b><a href="qstring.html#indexOf-2">indexOf</a></b> ( QChar <i>ch</i>, int <i>from</i> = 0, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
90
<li><div class="fn"/>int <b><a href="qstring.html#indexOf-3">indexOf</a></b> ( const QRegExp &amp; <i>rx</i>, int <i>from</i> = 0 ) const</li>
 
91
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#insert">insert</a></b> ( int <i>i</i>, const QString &amp; <i>str</i> )</li>
 
92
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#insert-2">insert</a></b> ( int <i>i</i>, const QLatin1String &amp; <i>str</i> )</li>
 
93
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#insert-3">insert</a></b> ( int <i>i</i>, const QChar * <i>unicode</i>, int <i>size</i> )</li>
 
94
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#insert-4">insert</a></b> ( int <i>i</i>, QChar <i>ch</i> )</li>
 
95
<li><div class="fn"/>bool <b><a href="qstring.html#isEmpty">isEmpty</a></b> () const</li>
 
96
<li><div class="fn"/>bool <b><a href="qstring.html#isNull">isNull</a></b> () const</li>
 
97
<li><div class="fn"/>int <b><a href="qstring.html#lastIndexOf">lastIndexOf</a></b> ( const QString &amp; <i>str</i>, int <i>from</i> = -1, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
98
<li><div class="fn"/>int <b><a href="qstring.html#lastIndexOf-2">lastIndexOf</a></b> ( QChar <i>ch</i>, int <i>from</i> = -1, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
99
<li><div class="fn"/>int <b><a href="qstring.html#lastIndexOf-3">lastIndexOf</a></b> ( const QRegExp &amp; <i>rx</i>, int <i>from</i> = -1 ) const</li>
 
100
<li><div class="fn"/>QString <b><a href="qstring.html#left">left</a></b> ( int <i>len</i> ) const</li>
 
101
<li><div class="fn"/>QString <b><a href="qstring.html#leftJustified">leftJustified</a></b> ( int <i>width</i>, QChar <i>fill</i> = QLatin1Char( ' ' ), bool <i>truncate</i> = false ) const</li>
 
102
<li><div class="fn"/>int <b><a href="qstring.html#length">length</a></b> () const</li>
 
103
<li><div class="fn"/>int <b><a href="qstring.html#localeAwareCompare-2">localeAwareCompare</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
104
<li><div class="fn"/>QString <b><a href="qstring.html#mid">mid</a></b> ( int <i>i</i>, int <i>len</i> = -1 ) const</li>
 
105
<li><div class="fn"/>QString <b><a href="qstring.html#normalized">normalized</a></b> ( NormalizationForm <i>form</i> ) const</li>
 
106
<li><div class="fn"/>QString <b><a href="qstring.html#normalized-2">normalized</a></b> ( NormalizationForm <i>form</i>, QChar::UnicodeVersion <i>version</i> ) const</li>
 
107
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#prepend">prepend</a></b> ( const QString &amp; <i>str</i> )</li>
 
108
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#prepend-2">prepend</a></b> ( const QLatin1String &amp; <i>str</i> )</li>
 
109
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#prepend-3">prepend</a></b> ( const QByteArray &amp; <i>ba</i> )</li>
 
110
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#prepend-4">prepend</a></b> ( const char * <i>str</i> )</li>
 
111
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#prepend-5">prepend</a></b> ( QChar <i>ch</i> )</li>
 
112
<li><div class="fn"/>void <b><a href="qstring.html#push_back">push_back</a></b> ( const QString &amp; <i>other</i> )</li>
 
113
<li><div class="fn"/>void <b><a href="qstring.html#push_back-2">push_back</a></b> ( QChar <i>ch</i> )</li>
 
114
<li><div class="fn"/>void <b><a href="qstring.html#push_front">push_front</a></b> ( const QString &amp; <i>other</i> )</li>
 
115
<li><div class="fn"/>void <b><a href="qstring.html#push_front-2">push_front</a></b> ( QChar <i>ch</i> )</li>
 
116
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#remove">remove</a></b> ( int <i>pos</i>, int <i>len</i> )</li>
 
117
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#remove-4">remove</a></b> ( const QString &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
 
118
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#remove-5">remove</a></b> ( QChar <i>ch</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
 
119
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#remove-6">remove</a></b> ( const QRegExp &amp; <i>rx</i> )</li>
 
120
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace">replace</a></b> ( int <i>pos</i>, int <i>len</i>, const QString &amp; <i>after</i> )</li>
 
121
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace-6">replace</a></b> ( int <i>pos</i>, int <i>len</i>, const QChar * <i>unicode</i>, int <i>size</i> )</li>
 
122
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace-7">replace</a></b> ( int <i>pos</i>, int <i>len</i>, QChar <i>after</i> )</li>
 
123
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace-8">replace</a></b> ( const QString &amp; <i>before</i>, const QString &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
 
124
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace-9">replace</a></b> ( QChar <i>ch</i>, const QString &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
 
125
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace-10">replace</a></b> ( QChar <i>before</i>, QChar <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
 
126
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#replace-11">replace</a></b> ( const QRegExp &amp; <i>rx</i>, const QString &amp; <i>after</i> )</li>
 
127
<li><div class="fn"/>void <b><a href="qstring.html#reserve">reserve</a></b> ( int <i>size</i> )</li>
 
128
<li><div class="fn"/>void <b><a href="qstring.html#resize">resize</a></b> ( int <i>size</i> )</li>
 
129
<li><div class="fn"/>QString <b><a href="qstring.html#right">right</a></b> ( int <i>len</i> ) const</li>
 
130
<li><div class="fn"/>QString <b><a href="qstring.html#rightJustified">rightJustified</a></b> ( int <i>width</i>, QChar <i>fill</i> = QLatin1Char( ' ' ), bool <i>truncate</i> = false ) const</li>
 
131
<li><div class="fn"/>QString <b><a href="qstring.html#section">section</a></b> ( QChar <i>sep</i>, int <i>start</i>, int <i>end</i> = -1, SectionFlags <i>flags</i> = SectionDefault ) const</li>
 
132
<li><div class="fn"/>QString <b><a href="qstring.html#section-2">section</a></b> ( const QString &amp; <i>sep</i>, int <i>start</i>, int <i>end</i> = -1, SectionFlags <i>flags</i> = SectionDefault ) const</li>
 
133
<li><div class="fn"/>QString <b><a href="qstring.html#section-3">section</a></b> ( const QRegExp &amp; <i>reg</i>, int <i>start</i>, int <i>end</i> = -1, SectionFlags <i>flags</i> = SectionDefault ) const</li>
 
134
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum">setNum</a></b> ( int <i>n</i>, int <i>base</i> = 10 )</li>
 
135
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-2">setNum</a></b> ( uint <i>n</i>, int <i>base</i> = 10 )</li>
 
136
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-3">setNum</a></b> ( long <i>n</i>, int <i>base</i> = 10 )</li>
 
137
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-4">setNum</a></b> ( ulong <i>n</i>, int <i>base</i> = 10 )</li>
 
138
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-5">setNum</a></b> ( qlonglong <i>n</i>, int <i>base</i> = 10 )</li>
 
139
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-6">setNum</a></b> ( qulonglong <i>n</i>, int <i>base</i> = 10 )</li>
 
140
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-7">setNum</a></b> ( short <i>n</i>, int <i>base</i> = 10 )</li>
 
141
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-8">setNum</a></b> ( ushort <i>n</i>, int <i>base</i> = 10 )</li>
 
142
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-9">setNum</a></b> ( double <i>n</i>, char <i>f</i> = 'g', int <i>prec</i> = 6 )</li>
 
143
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setNum-10">setNum</a></b> ( float <i>n</i>, char <i>f</i> = 'g', int <i>prec</i> = 6 )</li>
 
144
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setUnicode">setUnicode</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</li>
 
145
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#setUtf16">setUtf16</a></b> ( const ushort * <i>unicode</i>, int <i>size</i> )</li>
 
146
<li><div class="fn"/>QString <b><a href="qstring.html#simplified">simplified</a></b> () const</li>
 
147
<li><div class="fn"/>int <b><a href="qstring.html#size">size</a></b> () const</li>
 
148
<li><div class="fn"/>QStringList <b><a href="qstring.html#split">split</a></b> ( const QString &amp; <i>sep</i>, SplitBehavior <i>behavior</i> = KeepEmptyParts, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
149
<li><div class="fn"/>QStringList <b><a href="qstring.html#split-2">split</a></b> ( const QChar &amp; <i>sep</i>, SplitBehavior <i>behavior</i> = KeepEmptyParts, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
150
<li><div class="fn"/>QStringList <b><a href="qstring.html#split-3">split</a></b> ( const QRegExp &amp; <i>rx</i>, SplitBehavior <i>behavior</i> = KeepEmptyParts ) const</li>
 
151
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#sprintf">sprintf</a></b> ( const char * <i>cformat</i>, ... )</li>
 
152
<li><div class="fn"/>void <b><a href="qstring.html#squeeze">squeeze</a></b> ()</li>
 
153
<li><div class="fn"/>bool <b><a href="qstring.html#startsWith">startsWith</a></b> ( const QString &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
154
<li><div class="fn"/>bool <b><a href="qstring.html#startsWith-3">startsWith</a></b> ( const QLatin1String &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
155
<li><div class="fn"/>bool <b><a href="qstring.html#startsWith-4">startsWith</a></b> ( const QChar &amp; <i>c</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
 
156
<li><div class="fn"/>QByteArray <b><a href="qstring.html#toAscii">toAscii</a></b> () const</li>
 
157
<li><div class="fn"/>double <b><a href="qstring.html#toDouble">toDouble</a></b> ( bool * <i>ok</i> = 0 ) const</li>
 
158
<li><div class="fn"/>float <b><a href="qstring.html#toFloat">toFloat</a></b> ( bool * <i>ok</i> = 0 ) const</li>
 
159
<li><div class="fn"/>int <b><a href="qstring.html#toInt">toInt</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
160
<li><div class="fn"/>QByteArray <b><a href="qstring.html#toLatin1">toLatin1</a></b> () const</li>
 
161
<li><div class="fn"/>QByteArray <b><a href="qstring.html#toLocal8Bit">toLocal8Bit</a></b> () const</li>
 
162
<li><div class="fn"/>long <b><a href="qstring.html#toLong">toLong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
163
<li><div class="fn"/>qlonglong <b><a href="qstring.html#toLongLong">toLongLong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
164
<li><div class="fn"/>QString <b><a href="qstring.html#toLower">toLower</a></b> () const</li>
 
165
<li><div class="fn"/>short <b><a href="qstring.html#toShort">toShort</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
166
<li><div class="fn"/>std::string <b><a href="qstring.html#toStdString">toStdString</a></b> () const</li>
 
167
<li><div class="fn"/>std::wstring <b><a href="qstring.html#toStdWString">toStdWString</a></b> () const</li>
 
168
<li><div class="fn"/>uint <b><a href="qstring.html#toUInt">toUInt</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
169
<li><div class="fn"/>ulong <b><a href="qstring.html#toULong">toULong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
170
<li><div class="fn"/>qulonglong <b><a href="qstring.html#toULongLong">toULongLong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
171
<li><div class="fn"/>ushort <b><a href="qstring.html#toUShort">toUShort</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</li>
 
172
<li><div class="fn"/>QString <b><a href="qstring.html#toUpper">toUpper</a></b> () const</li>
 
173
<li><div class="fn"/>QByteArray <b><a href="qstring.html#toUtf8">toUtf8</a></b> () const</li>
 
174
<li><div class="fn"/>QString <b><a href="qstring.html#trimmed">trimmed</a></b> () const</li>
 
175
<li><div class="fn"/>void <b><a href="qstring.html#truncate">truncate</a></b> ( int <i>pos</i> )</li>
 
176
<li><div class="fn"/>const QChar * <b><a href="qstring.html#unicode">unicode</a></b> () const</li>
 
177
<li><div class="fn"/>const ushort * <b><a href="qstring.html#utf16">utf16</a></b> () const</li>
 
178
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#vsprintf">vsprintf</a></b> ( const char * <i>cformat</i>, va_list <i>ap</i> )</li>
 
179
<li><div class="fn"/>bool <b><a href="qstring.html#operator-not-eq">operator!=</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
180
<li><div class="fn"/>bool <b><a href="qstring.html#operator-not-eq-2">operator!=</a></b> ( const QLatin1String &amp; <i>other</i> ) const</li>
 
181
<li><div class="fn"/>bool <b><a href="qstring.html#operator-not-eq-3">operator!=</a></b> ( const QByteArray &amp; <i>other</i> ) const</li>
 
182
<li><div class="fn"/>bool <b><a href="qstring.html#operator-not-eq-4">operator!=</a></b> ( const char * <i>other</i> ) const</li>
 
183
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-2b-eq">operator+=</a></b> ( const QString &amp; <i>other</i> )</li>
 
184
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-2b-eq-2">operator+=</a></b> ( const QLatin1String &amp; <i>str</i> )</li>
 
185
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-2b-eq-3">operator+=</a></b> ( const QByteArray &amp; <i>ba</i> )</li>
 
186
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-2b-eq-4">operator+=</a></b> ( const char * <i>str</i> )</li>
 
187
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-2b-eq-5">operator+=</a></b> ( char <i>ch</i> )</li>
 
188
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-2b-eq-6">operator+=</a></b> ( QChar <i>ch</i> )</li>
 
189
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt">operator&lt;</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
190
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-2">operator&lt;</a></b> ( const QLatin1String &amp; <i>other</i> ) const</li>
 
191
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-3">operator&lt;</a></b> ( const QByteArray &amp; <i>other</i> ) const</li>
 
192
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-4">operator&lt;</a></b> ( const char * <i>other</i> ) const</li>
 
193
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-eq">operator&lt;=</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
194
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-eq-2">operator&lt;=</a></b> ( const QLatin1String &amp; <i>other</i> ) const</li>
 
195
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-eq-3">operator&lt;=</a></b> ( const QByteArray &amp; <i>other</i> ) const</li>
 
196
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-eq-4">operator&lt;=</a></b> ( const char * <i>other</i> ) const</li>
 
197
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-eq">operator=</a></b> ( const QString &amp; <i>other</i> )</li>
 
198
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-eq-3">operator=</a></b> ( const QLatin1String &amp; <i>str</i> )</li>
 
199
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-eq-4">operator=</a></b> ( const QByteArray &amp; <i>ba</i> )</li>
 
200
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-eq-5">operator=</a></b> ( const char * <i>str</i> )</li>
 
201
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-eq-6">operator=</a></b> ( char <i>ch</i> )</li>
 
202
<li><div class="fn"/>QString &amp; <b><a href="qstring.html#operator-eq-7">operator=</a></b> ( QChar <i>ch</i> )</li>
 
203
<li><div class="fn"/>bool <b><a href="qstring.html#operator-eq-eq">operator==</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
204
<li><div class="fn"/>bool <b><a href="qstring.html#operator-eq-eq-2">operator==</a></b> ( const QLatin1String &amp; <i>other</i> ) const</li>
 
205
<li><div class="fn"/>bool <b><a href="qstring.html#operator-eq-eq-3">operator==</a></b> ( const QByteArray &amp; <i>other</i> ) const</li>
 
206
<li><div class="fn"/>bool <b><a href="qstring.html#operator-eq-eq-4">operator==</a></b> ( const char * <i>other</i> ) const</li>
 
207
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt">operator&gt;</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
208
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-2">operator&gt;</a></b> ( const QLatin1String &amp; <i>other</i> ) const</li>
 
209
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-3">operator&gt;</a></b> ( const QByteArray &amp; <i>other</i> ) const</li>
 
210
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-4">operator&gt;</a></b> ( const char * <i>other</i> ) const</li>
 
211
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-eq">operator&gt;=</a></b> ( const QString &amp; <i>other</i> ) const</li>
 
212
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-eq-2">operator&gt;=</a></b> ( const QLatin1String &amp; <i>other</i> ) const</li>
 
213
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-eq-3">operator&gt;=</a></b> ( const QByteArray &amp; <i>other</i> ) const</li>
 
214
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-eq-4">operator&gt;=</a></b> ( const char * <i>other</i> ) const</li>
 
215
<li><div class="fn"/>QCharRef <b><a href="qstring.html#operator-5b-5d">operator[]</a></b> ( int <i>i</i> )</li>
 
216
<li><div class="fn"/>const QChar <b><a href="qstring.html#operator-5b-5d-2">operator[]</a></b> ( int <i>i</i> ) const</li>
 
217
<li><div class="fn"/>QCharRef <b><a href="qstring.html#operator-5b-5d-3">operator[]</a></b> ( uint <i>i</i> )</li>
 
218
<li><div class="fn"/>const QChar <b><a href="qstring.html#operator-5b-5d-4">operator[]</a></b> ( uint <i>i</i> ) const</li>
 
219
</ul>
 
220
<a name="static-public-members"></a>
 
221
<h3>Static Public Members</h3>
 
222
<ul>
 
223
<li><div class="fn"/>int <b><a href="qstring.html#compare">compare</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
224
<li><div class="fn"/>QString <b><a href="qstring.html#fromAscii">fromAscii</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</li>
 
225
<li><div class="fn"/>QString <b><a href="qstring.html#fromLatin1">fromLatin1</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</li>
 
226
<li><div class="fn"/>QString <b><a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</li>
 
227
<li><div class="fn"/>QString <b><a href="qstring.html#fromRawData">fromRawData</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</li>
 
228
<li><div class="fn"/>QString <b><a href="qstring.html#fromStdString">fromStdString</a></b> ( const std::string &amp; <i>str</i> )</li>
 
229
<li><div class="fn"/>QString <b><a href="qstring.html#fromStdWString">fromStdWString</a></b> ( const std::wstring &amp; <i>str</i> )</li>
 
230
<li><div class="fn"/>QString <b><a href="qstring.html#fromUtf8">fromUtf8</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</li>
 
231
<li><div class="fn"/>QString <b><a href="qstring.html#fromUtf16">fromUtf16</a></b> ( const ushort * <i>unicode</i>, int <i>size</i> = -1 )</li>
 
232
<li><div class="fn"/>int <b><a href="qstring.html#localeAwareCompare">localeAwareCompare</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
233
<li><div class="fn"/>QString <b><a href="qstring.html#number">number</a></b> ( long <i>n</i>, int <i>base</i> = 10 )</li>
 
234
<li><div class="fn"/>QString <b><a href="qstring.html#number-2">number</a></b> ( ulong <i>n</i>, int <i>base</i> = 10 )</li>
 
235
<li><div class="fn"/>QString <b><a href="qstring.html#number-3">number</a></b> ( int <i>n</i>, int <i>base</i> = 10 )</li>
 
236
<li><div class="fn"/>QString <b><a href="qstring.html#number-4">number</a></b> ( uint <i>n</i>, int <i>base</i> = 10 )</li>
 
237
<li><div class="fn"/>QString <b><a href="qstring.html#number-5">number</a></b> ( qlonglong <i>n</i>, int <i>base</i> = 10 )</li>
 
238
<li><div class="fn"/>QString <b><a href="qstring.html#number-6">number</a></b> ( qulonglong <i>n</i>, int <i>base</i> = 10 )</li>
 
239
<li><div class="fn"/>QString <b><a href="qstring.html#number-7">number</a></b> ( double <i>n</i>, char <i>f</i> = 'g', int <i>prec</i> = 6 )</li>
 
240
</ul>
 
241
<a name="related-non-members"></a>
 
242
<h3>Related Non-Members</h3>
 
243
<ul>
 
244
<li><div class="fn"/>bool <b><a href="qstring.html#operator-not-eq-30">operator!=</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
245
<li><div class="fn"/>const QString <b><a href="qstring.html#operator-2b-7">operator+</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
246
<li><div class="fn"/>const QString <b><a href="qstring.html#operator-2b-20">operator+</a></b> ( const QString &amp; <i>s1</i>, const char * <i>s2</i> )</li>
 
247
<li><div class="fn"/>const QString <b><a href="qstring.html#operator-2b-21">operator+</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
248
<li><div class="fn"/>const QString <b><a href="qstring.html#operator-2b-22">operator+</a></b> ( const QString &amp; <i>s</i>, char <i>ch</i> )</li>
 
249
<li><div class="fn"/>const QString <b><a href="qstring.html#operator-2b-23">operator+</a></b> ( char <i>ch</i>, const QString &amp; <i>s</i> )</li>
 
250
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-11">operator&lt;</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
251
<li><div class="fn"/>QDataStream &amp; <b><a href="qstring.html#operator-lt-lt-52">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>out</i>, const QString &amp; <i>str</i> )</li>
 
252
<li><div class="fn"/>bool <b><a href="qstring.html#operator-lt-eq-11">operator&lt;=</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
253
<li><div class="fn"/>bool <b><a href="qstring.html#operator-eq-eq-40">operator==</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
254
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-11">operator&gt;</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
255
<li><div class="fn"/>bool <b><a href="qstring.html#operator-gt-eq-11">operator&gt;=</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</li>
 
256
<li><div class="fn"/>QDataStream &amp; <b><a href="qstring.html#operator-gt-gt-33">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>in</i>, QString &amp; <i>str</i> )</li>
 
257
</ul>
 
258
<a name="details"></a>
 
259
<hr />
 
260
<h2>Detailed Description</h2>
 
261
<p>The QString class provides a Unicode character string.</p>
 
262
<p>QString stores a string of 16-bit <a href="qchar.html">QChar</a>s, where each <a href="qchar.html">QChar</a> stores one Unicode 4.0 character. <a href="unicode.html">Unicode</a> is an international standard that supports most of the writing systems in use today. It is a superset of ASCII and Latin-1 (ISO 8859-1), and all the ASCII/Latin-1 characters are available at the same code positions.</p>
 
263
<p>Behind the scenes, QString uses <a href="shclass.html#implicit-sharing">implicit sharing</a> (copy-on-write) to reduce memory usage and to avoid the needless copying of data. This also helps reduce the inherent overhead of storing 16-bit characters instead of 8-bit characters.</p>
 
264
<p>In addition to QString, Qt also provides the <a href="qbytearray.html">QByteArray</a> class to store raw bytes and traditional 8-bit '\0'-terminated strings. For most purposes, QString is the class you want to use. It is used throughout the Qt API, and the Unicode support ensures that your applications will be easy to translate if you want to expand your application's market at some point. The two main cases where <a href="qbytearray.html">QByteArray</a> is appropriate are when you need to store raw binary data, and when memory conservation is critical (e.g. with Qt/Embedded).</p>
 
265
<p>One way to initialize a QString is simply to pass a <tt>const char *</tt> to its constructor. For example, the following code creates a QString of size 5 containing the data &quot;Hello&quot;:</p>
 
266
<pre>&nbsp;   QString str = &quot;Hello&quot;;</pre>
 
267
<p>QString converts the <tt>const char *</tt> data into Unicode using <a href="qstring.html#fromAscii">fromAscii</a>(). By default, <a href="qstring.html#fromAscii">fromAscii</a>() treats character above 128 as Latin-1 characters, but this can be changed by calling <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>().</p>
 
268
<p>In all of the QString methods that take <tt>const char *</tt> parameters, the <tt>const char *</tt> is interpreted as a classic C-style '\0'-terminated string. It is legal for the <tt>const char *</tt> parameter to be 0.</p>
 
269
<p>You can also provide string data as an array of <a href="qchar.html">QChar</a>s:</p>
 
270
<pre>&nbsp;   static const QChar data[4] = { 0x0055, 0x006e, 0x10e3, 0x03a3 };
 
271
    QString str(data, 4);</pre>
 
272
<p>QString makes a deep copy of the <a href="qchar.html">QChar</a> data, so you can modify it later without experiencing side effects. (If for performance reasons you don't want to take a deep copy of the character data, use <a href="qstring.html#fromRawData">QString::fromRawData</a>() instead.)</p>
 
273
<p>Another approach is to set the size of the string using <a href="qstring.html#resize">resize</a>() and to initialize the data character per character. QString uses 0-based indexes, just like C++ arrays. To access the character at a particular index position, you can use operator[](). On non-const strings, operator[]() returns a reference to a character that can be used on the left side of an assignment. For example:</p>
 
274
<pre>&nbsp;   QString str;
 
275
    str.resize(4);
 
276
    str[0] = QChar('U');
 
277
    str[1] = QChar('n');
 
278
    str[2] = QChar(0x10e3);
 
279
    str[3] = QChar(0x03a3);</pre>
 
280
<p>For read-only access, an alternative syntax is to use <a href="qstring.html#at">at</a>():</p>
 
281
<pre>&nbsp;   for (int i = 0; i &lt; str.size(); ++i) {
 
282
        if (str.at(i) &gt;= QChar('a') &amp;&amp; str.at(i) &lt;= QChar('f'))
 
283
            cout &lt;&lt; &quot;Found character in range [a-f]&quot; &lt;&lt; endl;
 
284
    }</pre>
 
285
<p><a href="qstring.html#at">at</a>() can be faster than operator[](), because it never causes a <a href="shclass.html#deep-copy">deep copy</a> to occur.</p>
 
286
<p>To extract several characters at a time, use <a href="qstring.html#left">left</a>(), <a href="qstring.html#right">right</a>(), or <a href="qstring.html#mid">mid</a>().</p>
 
287
<p>A QString can embed '\0' characters (<a href="qchar.html#SpecialCharacter-enum">QChar::null</a>). The <a href="qstring.html#size">size</a>() function always returns the size of the whole string, including embedded '\0' characters.</p>
 
288
<p>After a call to <a href="qstring.html#resize">resize</a>(), newly allocated characters have undefined values. To set all the characters in the string to a particular value, call <a href="qstring.html#fill">fill</a>().</p>
 
289
<p>QString provides dozens of overloads designed to simplify string usage. For example, if you want to compare a QString with a string literal, you can write code like this and it will work as expected:</p>
 
290
<pre>&nbsp;   if (str == &quot;auto&quot; || str == &quot;extern&quot;
 
291
            || str == &quot;static&quot; || str == &quot;register&quot;) {
 
292
        ...
 
293
    }</pre>
 
294
<p>You can also pass string literals to functions that take QStrings and the QString(const char *) constructor will be invoked. Similarly, you can pass a QString to a function that takes a <tt>const char *</tt> and <a href="qstring-qt3.html#operator-const-char--2a">operator const char *</a>() will be invoked.</p>
 
295
<p>QString provides the following basic functions for modifying the character data: <a href="qstring.html#append">append</a>(), <a href="qstring.html#prepend">prepend</a>(), <a href="qstring.html#insert">insert</a>(), <a href="qstring.html#replace">replace</a>(), and <a href="qstring.html#remove">remove</a>(). For example:</p>
 
296
<pre>&nbsp;   QString str = &quot;and&quot;;
 
297
    str.prepend(&quot;rock &quot;);           // str == &quot;rock and&quot;
 
298
    str.append(&quot; roll&quot;);            // str == &quot;rock and roll&quot;
 
299
    str.replace(5, 3, &quot;&amp;&quot;);         // str == &quot;rock &amp; roll&quot;</pre>
 
300
<p>The <a href="qstring.html#replace">replace</a>() and <a href="qstring.html#remove">remove</a>() functions' first two arguments are the position from which to start erasing and the number of characters that should be erased.</p>
 
301
<p>A frequent requirement is to remove whitespace characters from a string ('\n', '\t', ' ', etc.). If you want to remove whitespace from both ends of a QString, use <a href="qstring.html#trimmed">trimmed</a>(). If you want to remove whitespace from both ends and replace multiple consecutive whitespaces with a single space character within the string, use <a href="qstring.html#simplified">simplified</a>().</p>
 
302
<p>If you want to find all occurrences of a particular character or substring in a QString, use <a href="qstring.html#indexOf">indexOf</a>() or <a href="qstring.html#lastIndexOf">lastIndexOf</a>(). The former searches forward starting from a given index position, the latter searches backward. Both return the index position of the character or substring if they find it; otherwise, they return -1. For example, here's a typical loop that finds all occurrences of a particular substring:</p>
 
303
<pre>&nbsp;   QString str = &quot;We must be &lt;b&gt;bold&lt;/b&gt;, very &lt;b&gt;bold&lt;/b&gt;&quot;;
 
304
    int j = 0;
 
305
    while ((j = str.indexOf(&quot;&lt;b&gt;&quot;, j)) != -1) {
 
306
        cout &lt;&lt; &quot;Found &lt;b&gt; tag at index position &quot; &lt;&lt; j &lt;&lt; endl;
 
307
        ++j;
 
308
    }</pre>
 
309
<p>If you want to see if a QString starts or ends with a particular substring use <a href="qstring.html#startsWith">startsWith</a>() or <a href="qstring.html#endsWith">endsWith</a>(). If you simply want to check whether a QString contains a particular character or substring, use <a href="qstring.html#contains">contains</a>(). If you want to find out how many times a particular character or substring occurs in the string, use <a href="qstring.html#count">count</a>().</p>
 
310
<p>QString provides many functions for converting numbers into strings and strings into numbers. See the <a href="qstring.html#arg">arg</a>() functions, the <a href="qstring.html#setNum">setNum</a>() functions, the <a href="qstring.html#number">number</a>() static functions, and the <a href="qstring.html#toInt">toInt</a>(), <a href="qstring.html#toDouble">toDouble</a>(), and similar functions.</p>
 
311
<p>To get an upper or lower case version of a string use <a href="qstring.html#toUpper">toUpper</a>() or <a href="qstring.html#toLower">toLower</a>().</p>
 
312
<p>If you want to replace all occurrences of a particular substring with another, use one of the two-parameter <a href="qstring.html#replace">replace</a>() overloads.</p>
 
313
<p>QStrings can be compared using overloaded operators such as operator&lt;(), operator&lt;=(), operator==(), operator&gt;=(), and so on. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() is a better choice for sorting user-interface strings.</p>
 
314
<p>Lists of strings are handled by the <a href="qstringlist.html">QStringList</a> class. You can split a string into a list of strings using <a href="qstring.html#split">split</a>(), and join a list of strings into a single string with an optional separator using <a href="qstringlist.html#join">QStringList::join</a>(). You can obtain a list of strings from a string list that contain a particular substring or that match a particular <a href="qregexp.html">QRegExp</a> using <a href="qlist-qt3.html#find">QStringList::find</a>().</p>
 
315
<p>If you are building a QString gradually and know in advance approximately how many characters the QString will contain, you can call <a href="qstring.html#reserve">reserve</a>(), asking QString to preallocate a certain amount of memory. You can also call <a href="qstring.html#capacity">capacity</a>() to find out how much memory QString actually allocated.</p>
 
316
<p>To obtain a pointer to the actual character data, call <a href="qstring.html#data">data</a>() or <a href="qstring.html#constData">constData</a>(). These functions return a pointer to the beginning of the <a href="qchar.html">QChar</a> data. The pointer is guaranteed to remain valid until a non-const function is called on the QString.</p>
 
317
<a name="conversions-between-8-bit-strings-and-unicode-strings"></a>
 
318
<h3>Conversions between 8-bit strings and Unicode strings</h3>
 
319
<p>QString provides the following four functions that return a <tt>const char *</tt> version of the string as <a href="qbytearray.html">QByteArray</a>: <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().</p>
 
320
<ul>
 
321
<li><a href="qstring.html#toAscii">toAscii</a>() returns an ASCII encoded 8-bit string.</li>
 
322
<li><a href="qstring.html#toLatin1">toLatin1</a>() returns a Latin-1 (ISO 8859-1) encoded 8-bit string.</li>
 
323
<li><a href="qstring.html#toUtf8">toUtf8</a>() returns a UTF-8 encoded 8-bit string. UTF-8 is a superset of ASCII that supports the entire Unicode character set through multibyte sequences.</li>
 
324
<li><a href="qstring.html#toLocal8Bit">toLocal8Bit</a>() returns an 8-bit string using the system's local encoding.</li>
 
325
</ul>
 
326
<p>To convert from one of these encodings, QString provides <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(). Other encodings are supported through <a href="qtextcodec.html">QTextCodec</a>.</p>
 
327
<p>As mentioned above, QString provides a lot of functions and operators that make it easy to interoperate with <tt>const char *</tt> strings. This functionaly is a two-edged sword: It makes QString more convenient to use if all strings are ASCII or Latin-1, but there is always the risk that an implicit conversion from or to <tt>const char *</tt> is done using the wrong 8-bit encoding. To minimize these risks, you can turn off these implicit conversions by defining these two preprocessor symbols:</p>
 
328
<ul>
 
329
<li><tt>QT_NO_CAST_FROM_ASCII</tt> disables automatic conversions from ASCII to Unicode.</li>
 
330
<li><tt>QT_NO_CAST_TO_ASCII</tt> disables automatic conversion from QString to ASCII.</li>
 
331
</ul>
 
332
<p>One way to define these prepocessor symbols globally for your application is to add the following entry to your <a href="qmake-project-files.html">qmake project file</a>:</p>
 
333
<pre>&nbsp;   DEFINES += QT_NO_CAST_FROM_ASCII \
 
334
               QT_NO_CAST_TO_ASCII</pre>
 
335
<p>You then need to explicitly call <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), or <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>() to construct a QString from an 8-bit string, or use the lightweight <a href="qlatin1string.html">QLatin1String</a> class, for example:</p>
 
336
<pre>&nbsp;   QString url = QLatin1String(&quot;http://www.unicode.org/&quot;);</pre>
 
337
<p>Similarly, you must call <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), or <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>() explicitly to convert the QString to an 8-bit string. (Other encodings are supported through <a href="qtextcodec.html">QTextCodec</a>.)</p>
 
338
<a name="note-for-c-programmers"></a>
 
339
<h3>Note for C programmers</h3>
 
340
<p>Due to C++'s type system and the fact that QString is <a href="shclass.html#implicitly-shared">implicitly shared</a>, QStrings may be treated like <tt>int</tt>s or other basic types. For example:</p>
 
341
<pre>&nbsp;   QString boolToString(bool b)
 
342
    {
 
343
        QString result;
 
344
        if (b)
 
345
            result = &quot;True&quot;;
 
346
        else
 
347
            result = &quot;False&quot;;
 
348
        return result;
 
349
    }</pre>
 
350
<p>The variable, result, is a normal variable allocated on the stack. When return is called, because we're returning by value, The copy constructor is called and a copy of the string is returned. (No actual copying takes place thanks to the implicit sharing.)</p>
 
351
<a name="distinction-between-null-and-empty-strings"></a>
 
352
<h3>Distinction between null and empty strings</h3>
 
353
<p>For historical reasons, QString distinguishes between a null string and an empty string. A <i>null</i> string is a string that is initialized using QString's default constructor or by passing (const char *)0 to the constructor. An <i>empty</i> string is any string with size 0. A null string is always empty, but an empty string isn't necessarily null:</p>
 
354
<pre>&nbsp;       QString().isNull();             // returns true
 
355
        QString().isEmpty();            // returns true
 
356
 
 
357
        QString(&quot;&quot;).isNull();           // returns false
 
358
        QString(&quot;&quot;).isEmpty();          // returns true
 
359
 
 
360
        QString(&quot;abc&quot;).isNull();        // returns false
 
361
        QString(&quot;abc&quot;).isEmpty();       // returns false</pre>
 
362
<p>All functions except <a href="qstring.html#isNull">isNull</a>() treat null strings the same as empty strings. For example, <a href="qstring.html#toAscii">toAscii</a>().<a href="qstring.html#constData">constData</a>() returns a pointer to a '\0' character for a null string (<i>not</i> a null pointer), and <a href="qstring.html#QString">QString</a>() compares equal to QString(&quot;&quot;). We recommend that you always use <a href="qstring.html#isEmpty">isEmpty</a>() and avoid <a href="qstring.html#isNull">isNull</a>().</p>
 
363
<p>See also <a href="qstring.html#fromRawData">fromRawData</a>(), <a href="qchar.html">QChar</a>, <a href="qlatin1string.html">QLatin1String</a>, and <a href="qbytearray.html">QByteArray</a>.</p>
 
364
<hr />
 
365
<h2>Member Type Documentation</h2>
 
366
<h3 class="fn"><a name="NormalizationForm-enum"></a>enum QString::NormalizationForm</h3>
 
367
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
368
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
369
<tr><td valign="top"><tt>QString::NormalizationForm_D</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Canonical Decomposition</td></tr>
 
370
<tr><td valign="top"><tt>QString::NormalizationForm_C</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Canonical Decomposition followed by Canonical Composition</td></tr>
 
371
<tr><td valign="top"><tt>QString::NormalizationForm_KD</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Compatibility Decomposition</td></tr>
 
372
<tr><td valign="top"><tt>QString::NormalizationForm_KC</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Compatibility Decomposition followed by Canonical Composition</td></tr>
 
373
</table>
 
374
<p>See also <a href="qstring.html#normalized">normalized</a>() and <a href="http://www.unicode.org/reports/tr15/">Unicode Standard Annex #15</a>.</p>
 
375
<h3 class="flags"><a name="SectionFlag-enum"></a>enum QString::SectionFlag<br />flags QString::SectionFlags</h3>
 
376
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
377
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
378
<tr><td valign="top"><tt>QString::SectionDefault</tt></td><td align="center" valign="top"><tt>0x00</tt></td><td valign="top">Empty fields are counted, leading and trailing separators are not included, and the separator is compared case sensitively.</td></tr>
 
379
<tr><td valign="top"><tt>QString::SectionSkipEmpty</tt></td><td align="center" valign="top"><tt>0x01</tt></td><td valign="top">Treat empty fields as if they don't exist, i.e. they are not considered as far as <i>start</i> and <i>end</i> are concerned.</td></tr>
 
380
<tr><td valign="top"><tt>QString::SectionIncludeLeadingSep</tt></td><td align="center" valign="top"><tt>0x02</tt></td><td valign="top">Include the leading separator (if any) in the result string.</td></tr>
 
381
<tr><td valign="top"><tt>QString::SectionIncludeTrailingSep</tt></td><td align="center" valign="top"><tt>0x04</tt></td><td valign="top">Include the trailing separator (if any) in the result string.</td></tr>
 
382
<tr><td valign="top"><tt>QString::SectionCaseInsensitiveSeps</tt></td><td align="center" valign="top"><tt>0x08</tt></td><td valign="top">Compare the separator case-insensitively.</td></tr>
 
383
</table>
 
384
<p>The SectionFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;SectionFlag&gt;. It stores an OR combination of SectionFlag values.</p>
 
385
<p>See also <a href="qstring.html#section">section</a>().</p>
 
386
<h3 class="fn"><a name="SplitBehavior-enum"></a>enum QString::SplitBehavior</h3>
 
387
<table border="1" cellpadding="2" cellspacing="1" width="40%">
 
388
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
 
389
<tr><td valign="top"><tt>QString::KeepEmptyParts</tt></td><td align="center" valign="top"><tt>0</tt></td></tr>
 
390
<tr><td valign="top"><tt>QString::SkipEmptyParts</tt></td><td align="center" valign="top"><tt>1</tt></td></tr>
 
391
</table>
 
392
<hr />
 
393
<h2>Member Function Documentation</h2>
 
394
<h3 class="fn"><a name="QString"></a>QString::QString ()</h3>
 
395
<p>Constructs a null string. Null strings are also empty.</p>
 
396
<p>See also <a href="qstring.html#isEmpty">isEmpty</a>().</p>
 
397
<h3 class="fn"><a name="QString-2"></a>QString::QString ( const <a href="qchar.html">QChar</a> * <i>unicode</i>, int <i>size</i> )</h3>
 
398
<p>Constructs a string initialized with the first <i>size</i> characters of the <a href="qchar.html">QChar</a> array <i>unicode</i>.</p>
 
399
<p><a href="qstring.html">QString</a> makes a deep copy of the string data.</p>
 
400
<h3 class="fn"><a name="QString-3"></a>QString::QString ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
401
<p>Constructs a string of size 1 containing the character <i>ch</i>.</p>
 
402
<h3 class="fn"><a name="QString-4"></a>QString::QString ( int <i>size</i>, <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
403
<p>Constructs a string of size <i>size</i> with every character set to <i>ch</i>.</p>
 
404
<p>See also <a href="qstring.html#fill">fill</a>().</p>
 
405
<h3 class="fn"><a name="QString-5"></a>QString::QString ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>str</i> )</h3>
 
406
<p>Constructs a copy of the Latin-1 string <i>str</i>.</p>
 
407
<p>See also <a href="qstring.html#fromLatin1">fromLatin1</a>().</p>
 
408
<h3 class="fn"><a name="QString-6"></a>QString::QString ( const QString &amp; <i>other</i> )</h3>
 
409
<p>Constructs a copy of <i>other</i>.</p>
 
410
<p>This operation takes <a href="containers.html#constant-time">constant time</a>, because <a href="qstring.html">QString</a> is <a href="shclass.html#implicitly-shared">implicitly shared</a>. This makes returning a <a href="qstring.html">QString</a> from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes <a href="containers.html#linear-time">linear time</a>.</p>
 
411
<p>See also <a href="qstring.html#operator-eq">operator=</a>().</p>
 
412
<h3 class="fn"><a name="QString-7"></a>QString::QString ( const char * <i>str</i> )</h3>
 
413
<p>Constructs a string initialized with the ASCII string <i>str</i>. <i>str</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
414
<p>You can disable this constructor by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
415
<p>See also <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
 
416
<h3 class="fn"><a name="QString-8"></a>QString::QString ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>ba</i> )</h3>
 
417
<p>Constructs a string initialized with the byte array <i>ba</i>. <i>ba</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
418
<p>You can disable this constructor by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
419
<h3 class="fn"><a name="dtor.QString"></a>QString::~QString ()</h3>
 
420
<p>Destroys the string.</p>
 
421
<h3 class="fn"><a name="append"></a>QString &amp; QString::append ( const QString &amp; <i>str</i> )</h3>
 
422
<p>Appends the string <i>str</i> onto the end of this string.</p>
 
423
<p>Example:</p>
 
424
<pre>&nbsp;   QString x = &quot;free&quot;;
 
425
    QString y = &quot;dom&quot;;
 
426
    x.append(y);
 
427
    // x == &quot;freedom&quot;</pre>
 
428
<p>This is the same as insert(<a href="qstring.html#size">size</a>(), <i>str</i>).</p>
 
429
<p>This operation is typically very fast (<a href="containers.html#constant-time">constant time</a>), because <a href="qstring.html">QString</a> preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.</p>
 
430
<p>See also <a href="qstring.html#operator-2b-eq">operator+=</a>(), <a href="qstring.html#prepend">prepend</a>(), and <a href="qstring.html#insert">insert</a>().</p>
 
431
<h3 class="fn"><a name="append-2"></a>QString &amp; QString::append ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>str</i> )</h3>
 
432
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
433
<p>Appends the Latin-1 string <i>str</i> to this string.</p>
 
434
<h3 class="fn"><a name="append-3"></a>QString &amp; QString::append ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>ba</i> )</h3>
 
435
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
436
<p>Appends the byte array <i>ba</i> to this string. <i>ba</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
437
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
438
<h3 class="fn"><a name="append-4"></a>QString &amp; QString::append ( const char * <i>str</i> )</h3>
 
439
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
440
<p>Appends the string <i>str</i> to this string. <i>str</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
441
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
442
<h3 class="fn"><a name="append-5"></a>QString &amp; QString::append ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
443
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
444
<p>Appends the character <i>ch</i> to this string.</p>
 
445
<h3 class="fn"><a name="arg"></a>QString QString::arg ( const QString &amp; <i>a</i>, int <i>fieldWidth</i> = 0, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
446
<p>This function returns a copy of this string where <i>a</i> replaces the lowest numbered occurrence of <tt>%1</tt>, <tt>%2</tt>, ..., <tt>%9</tt>.</p>
 
447
<p>The <i>fieldWidth</i> value specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value will produce right-aligned text, whereas a negative value will produce left-aligned text.</p>
 
448
<p>The following example shows how we could create a 'status' string when processing a list of files:</p>
 
449
<pre>&nbsp;   QString status = QString(&quot;Processing file %1 of %2: %3&quot;)
 
450
                        .arg(i)         // current file's number
 
451
                        .arg(total)     // number of files to process
 
452
                        .arg(fileName); // current file's name</pre>
 
453
<p>It is generally fine to use file names and numbers as we have done in the example above. But note that using arg() to construct natural language sentences does not usually translate well into other languages because sentence structure and word order often differ between languages.</p>
 
454
<p>If there is no place marker (<tt>%1</tt>, <tt>%2</tt>, etc.), a warning message is output and the result is undefined.</p>
 
455
<h3 class="fn"><a name="arg-2"></a>QString QString::arg ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i> ) const</h3>
 
456
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
457
<p>This is the same as str.arg(<i>a1</i>).arg(<i>a2</i>), except that the strings are replaced in one pass. This can make a difference if <i>a1</i> contains e.g. <tt>%1</tt>:</p>
 
458
<pre>&nbsp;   QString str = &quot;%1 %2&quot;;
 
459
    str.arg(&quot;%1f&quot;, &quot;Hello&quot;);        // returns &quot;%1f Hello&quot;
 
460
    str.arg(&quot;%1f&quot;).arg(&quot;Hello&quot;);    // returns &quot;Hellof&quot;</pre>
 
461
<h3 class="fn"><a name="arg-3"></a>QString QString::arg ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i> ) const</h3>
 
462
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
463
<p>This is the same as calling str.arg(<i>a1</i>).arg(<i>a2</i>).arg(<i>a3</i>), except that the strings are replaced in one pass.</p>
 
464
<h3 class="fn"><a name="arg-4"></a>QString QString::arg ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i> ) const</h3>
 
465
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
466
<p>This is the same as calling str.arg(<i>a1</i>).arg(<i>a2</i>).arg(<i>a3</i>).arg(<i>a4</i>), except that the strings are replaced in one pass.</p>
 
467
<h3 class="fn"><a name="arg-5"></a>QString QString::arg ( int <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
468
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
469
<p><i>a</i> is expressed in base <i>base</i>, which is 10 by default and must be between 2 and 36.</p>
 
470
<p>The <i>fieldWidth</i> value specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value will produce a right-aligned number, whereas a negative value will produce a left-aligned number.</p>
 
471
<p>The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of <i>a</i>. The conversion uses the default locale, set by QLocale::setDefaultLocale(). If no default locale was specified, the &quot;C&quot; locale is used. The 'L' flag is ignored if <i>base</i> is not 10.</p>
 
472
<pre>&nbsp;   QString str;
 
473
    str = QString(&quot;Decimal 63 is %1 in hexadecimal&quot;)
 
474
            .arg(63, 0, 16);
 
475
    // str == &quot;Decimal 63 is 3f in hexadecimal&quot;
 
476
 
 
477
    QLocale::setDefaultLocale(QLocale::English, QLocale::UnitedStates);
 
478
    str = QString(&quot;%1 %L2 %L3&quot;)
 
479
            .arg(12345)
 
480
            .arg(12345)
 
481
            .arg(12345, 0, 16);
 
482
    // str == &quot;12345 12,345 3039&quot;</pre>
 
483
<h3 class="fn"><a name="arg-6"></a>QString QString::arg ( <a href="qtglobal.html#uint-typedef">uint</a> <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
484
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
485
<p><i>base</i> is the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
 
486
<h3 class="fn"><a name="arg-7"></a>QString QString::arg ( long <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
487
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
488
<p>The <i>fieldWidth</i> value specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value will produce a right-aligned number, whereas a negative value will produce a left-aligned number.</p>
 
489
<p><i>a</i> is expressed in base <i>base</i>, which is 10 by default and must be between 2 and 36.</p>
 
490
<p>The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of <i>a</i>. The conversion uses the default locale. The default locale is determined from the system's locale settings at application startup. It can be changed using <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). The 'L' flag is ignored if <i>base</i> is not 10.</p>
 
491
<pre>&nbsp;   QString str;
 
492
    str = QString( &quot;Decimal 63 is %1 in hexadecimal&quot; )
 
493
            .arg( 63, 0, 16 );
 
494
    // str == &quot;Decimal 63 is 3f in hexadecimal&quot;
 
495
 
 
496
    QLocale::setDefault(QLocale::English, QLocale::UnitedStates);
 
497
    str = QString( &quot;%1 %L2 %L3&quot; )
 
498
            .arg( 12345 )
 
499
            .arg( 12345 )
 
500
            .arg( 12345, 0, 16 );
 
501
    // str == &quot;12345 12,345 3039&quot;</pre>
 
502
<h3 class="fn"><a name="arg-8"></a>QString QString::arg ( <a href="qtglobal.html#ulong-typedef">ulong</a> <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
503
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
504
<p><i>base</i> is the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
 
505
<h3 class="fn"><a name="arg-9"></a>QString QString::arg ( <a href="qtglobal.html#qlonglong-typedef">qlonglong</a> <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
506
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
507
<p><i>base</i> is the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
 
508
<h3 class="fn"><a name="arg-10"></a>QString QString::arg ( <a href="qtglobal.html#qulonglong-typedef">qulonglong</a> <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
509
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
510
<p><i>base</i> is the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
 
511
<h3 class="fn"><a name="arg-11"></a>QString QString::arg ( short <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
512
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
513
<p><i>base</i> is the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
 
514
<h3 class="fn"><a name="arg-12"></a>QString QString::arg ( <a href="qtglobal.html#ushort-typedef">ushort</a> <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
515
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
516
<p><i>base</i> is the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
 
517
<h3 class="fn"><a name="arg-13"></a>QString QString::arg ( <a href="qchar.html">QChar</a> <i>a</i>, int <i>fieldWidth</i> = 0, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
518
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
519
<h3 class="fn"><a name="arg-14"></a>QString QString::arg ( char <i>a</i>, int <i>fieldWidth</i> = 0, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
520
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
521
<p><i>a</i> is interpreded as a Latin-1 character.</p>
 
522
<h3 class="fn"><a name="arg-15"></a>QString QString::arg ( double <i>a</i>, int <i>fieldWidth</i> = 0, char <i>fmt</i> = 'g', int <i>prec</i> = -1, const <a href="qchar.html">QChar</a> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
 
523
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
524
<a name="arg-formats"></a><p>Argument <i>a</i> is formatted according to the <i>fmt</i> format specified, which is 'g' by default and can be any of the following:</p>
 
525
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
526
<tr valign="top" bgcolor="#a2c511"><th>Format</th><th>Meaning</th></tr>
 
527
<tr valign="top" bgcolor="#f0f0f0"><td><tt>e</tt></td><td>format as [-]9.9e[+|-]999</td></tr>
 
528
<tr valign="top" bgcolor="#e0e0e0"><td><tt>E</tt></td><td>format as [-]9.9E[+|-]999</td></tr>
 
529
<tr valign="top" bgcolor="#f0f0f0"><td><tt>f</tt></td><td>format as [-]9.9</td></tr>
 
530
<tr valign="top" bgcolor="#e0e0e0"><td><tt>g</tt></td><td>use <tt>e</tt> or <tt>f</tt> format, whichever is the most concise</td></tr>
 
531
<tr valign="top" bgcolor="#f0f0f0"><td><tt>G</tt></td><td>use <tt>E</tt> or <tt>f</tt> format, whichever is the most concise</td></tr>
 
532
</table>
 
533
<p>With 'e', 'E', and 'f', <i>prec</i> is the number of digits after the decimal point. With 'g' and 'G', <i>prec</i> is the maximum number of significant digits (trailing zeroes are omitted).</p>
 
534
<pre>&nbsp;   double d = 12.34;
 
535
    QString str = QString(&quot;delta: %1&quot;).arg(d, 0, 'E', 3);
 
536
    // str == &quot;delta: 1.234E+01&quot;</pre>
 
537
<p>The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of <i>a</i>. The conversion uses the default locale, set by QLocale::setDefaultLocale(). If no default locale was specified, the &quot;C&quot; locale is used.</p>
 
538
<h3 class="fn"><a name="at"></a>const <a href="qchar.html">QChar</a> QString::at ( int <i>i</i> ) const</h3>
 
539
<p>Returns the character at index position <i>i</i> in the string.</p>
 
540
<p><i>i</i> must be a valid index position in the string (i.e., 0 &lt;= <i>i</i> &lt; <a href="qstring.html#size">size</a>()).</p>
 
541
<p>See also <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
 
542
<h3 class="fn"><a name="capacity"></a>int QString::capacity () const</h3>
 
543
<p>Returns the maximum number of characters that can be stored in the string without forcing a reallocation.</p>
 
544
<p>The sole purpose of this function is to provide a means of fine tuning <a href="qstring.html">QString</a>'s memory usage. In general, you will rarely ever need to call this function. If you want to know how many characters are in the string, call <a href="qstring.html#size">size</a>().</p>
 
545
<p>See also <a href="qstring.html#reserve">reserve</a>() and <a href="qstring.html#squeeze">squeeze</a>().</p>
 
546
<h3 class="fn"><a name="chop"></a>void QString::chop ( int <i>n</i> )</h3>
 
547
<p>Removes <i>n</i> characters from the end of the string.</p>
 
548
<p>If <i>n</i> is greater than <a href="qstring.html#size">size</a>(), the result is an empty string.</p>
 
549
<p>Example:</p>
 
550
<pre>&nbsp;   QString str(&quot;LOGOUT\r\n&quot;);
 
551
    str.chop(2);
 
552
    // str == &quot;LOGOUT&quot;</pre>
 
553
<p>If you want to remove characters from the <i>beginning</i> of the string, use <a href="qstring.html#remove">remove</a>() instead.</p>
 
554
<p>See also <a href="qstring.html#truncate">truncate</a>(), <a href="qstring.html#resize">resize</a>(), and <a href="qstring.html#remove">remove</a>().</p>
 
555
<h3 class="fn"><a name="clear"></a>void QString::clear ()</h3>
 
556
<p>Clears the contents of the string and makes it empty.</p>
 
557
<p>See also <a href="qstring.html#resize">resize</a>() and <a href="qstring.html#isEmpty">isEmpty</a>().</p>
 
558
<h3 class="fn"><a name="compare"></a>int QString::compare ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
559
<p>Lexically compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
 
560
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
561
<pre>&nbsp;   int x = QString::compare(&quot;auto&quot;, &quot;auto&quot;);   // x == 0
 
562
    int y = QString::compare(&quot;auto&quot;, &quot;car&quot;);    // y &lt; 0
 
563
    int z = QString::compare(&quot;car&quot;, &quot;auto&quot;);    // z &gt; 0</pre>
 
564
<p>See also <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>(), <a href="qstring.html#operator-eq-eq">operator==</a>(), <a href="qstring.html#operator-lt">operator&lt;</a>(), and <a href="qstring.html#operator-gt">operator&gt;</a>().</p>
 
565
<h3 class="fn"><a name="compare-2"></a>int QString::compare ( const QString &amp; <i>other</i> ) const</h3>
 
566
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
567
<p>Same as compare(*this, <i>other</i>).</p>
 
568
<h3 class="fn"><a name="constData"></a>const <a href="qchar.html">QChar</a> * QString::constData () const</h3>
 
569
<p>Returns a pointer to the data stored in the <a href="qstring.html">QString</a>. The pointer can be used to access the characters that compose the string. For convenience, the data is '\0'-terminated.</p>
 
570
<p>The pointer remains valid as long as the string isn't modified.</p>
 
571
<p>See also <a href="qstring.html#data">data</a>() and <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
 
572
<h3 class="fn"><a name="contains"></a>bool QString::contains ( const QString &amp; <i>str</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
573
<p>Returns true if this string contains an occurrence of the string <i>str</i>; otherwise returns false.</p>
 
574
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
575
<p>Example:</p>
 
576
<pre>&nbsp;   QString str = &quot;Peter Pan&quot;;
 
577
    str.contains(&quot;peter&quot;, Qt::CaseInsensitive);    // returns true</pre>
 
578
<p>See also <a href="qstring.html#indexOf">indexOf</a>() and <a href="qstring.html#count">count</a>().</p>
 
579
<h3 class="fn"><a name="contains-4"></a>bool QString::contains ( <a href="qchar.html">QChar</a> <i>ch</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
580
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
581
<p>Returns true if this string contains an occurrence of the character <i>ch</i>; otherwise returns false.</p>
 
582
<h3 class="fn"><a name="contains-5"></a>bool QString::contains ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i> ) const</h3>
 
583
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
584
<p>Returns true if the regular expression <i>rx</i> matches somewhere in this string; otherwise returns false.</p>
 
585
<h3 class="fn"><a name="count"></a>int QString::count ( const QString &amp; <i>str</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
586
<p>Returns the number of (potentially overlapping) occurrences of the string <i>str</i> in this string.</p>
 
587
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
588
<p>See also <a href="qstring.html#contains">contains</a>() and <a href="qstring.html#indexOf">indexOf</a>().</p>
 
589
<h3 class="fn"><a name="count-2"></a>int QString::count ( <a href="qchar.html">QChar</a> <i>ch</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
590
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
591
<p>Returns the number of occurrences of character <i>ch</i> in the string.</p>
 
592
<h3 class="fn"><a name="count-3"></a>int QString::count ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i> ) const</h3>
 
593
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
594
<p>Returns the number of times the regular expression <i>rx</i> matches in the string.</p>
 
595
<p>This function counts overlapping matches, so in the example below, there are four instances of &quot;ana&quot; or &quot;ama&quot;:</p>
 
596
<pre>&nbsp;   QString str = &quot;banana and panama&quot;;
 
597
    str.contains(QRegExp(&quot;a[nm]a&quot;));    // returns 4</pre>
 
598
<h3 class="fn"><a name="count-4"></a>int QString::count () const</h3>
 
599
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
600
<p>Same as <a href="qstring.html#size">size</a>().</p>
 
601
<h3 class="fn"><a name="data"></a><a href="qchar.html">QChar</a> * QString::data ()</h3>
 
602
<p>Returns a pointer to the data stored in the <a href="qstring.html">QString</a>. The pointer can be used to access and modify the characters that compose the string. For convenience, the data is '\0'-terminated.</p>
 
603
<p>The pointer remains valid as long as the string isn't modified by other means.</p>
 
604
<p>Example:</p>
 
605
<pre>&nbsp;   QString str = &quot;Hello world&quot;;
 
606
    QChar *data = ba.data();
 
607
    while (*data) {
 
608
        cout &lt;&lt; &quot;[&quot; + data-&gt;unicode() + &quot;]&quot; &lt;&lt; endl;
 
609
        ++data;
 
610
    }</pre>
 
611
<p>See also <a href="qstring.html#constData">constData</a>() and <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
 
612
<h3 class="fn"><a name="data-2"></a>const <a href="qchar.html">QChar</a> * QString::data () const</h3>
 
613
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
614
<h3 class="fn"><a name="endsWith"></a>bool QString::endsWith ( const QString &amp; <i>s</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
615
<p>Returns true if the string ends with <i>s</i>; otherwise returns false.</p>
 
616
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
617
<pre>&nbsp;   QString str = &quot;Bananas&quot;;
 
618
    str.endsWith(&quot;anas&quot;);         // returns true
 
619
    str.endsWith(&quot;pple&quot;);         // returns false</pre>
 
620
<p>See also <a href="qstring.html#startsWith">startsWith</a>().</p>
 
621
<h3 class="fn"><a name="endsWith-3"></a>bool QString::endsWith ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>s</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
622
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
623
<h3 class="fn"><a name="endsWith-4"></a>bool QString::endsWith ( const <a href="qchar.html">QChar</a> &amp; <i>c</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
624
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
625
<h3 class="fn"><a name="fill"></a>QString &amp; QString::fill ( <a href="qchar.html">QChar</a> <i>ch</i>, int <i>size</i> = -1 )</h3>
 
626
<p>Sets every character in the string to character <i>ch</i>. If <i>size</i> is different from -1 (the default), the string is resized to <i>size</i> beforehand.</p>
 
627
<p>Example:</p>
 
628
<pre>&nbsp;   QString str = &quot;Berlin&quot;;
 
629
    str.fill(&quot;z&quot;);
 
630
    // str == &quot;zzzzzz&quot;
 
631
 
 
632
    str.fill(&quot;A&quot;, 2);
 
633
    // str == &quot;AA&quot;</pre>
 
634
<p>See also <a href="qstring.html#resize">resize</a>().</p>
 
635
<h3 class="fn"><a name="fromAscii"></a>QString QString::fromAscii ( const char * <i>str</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
636
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the 8-bit ASCII string <i>str</i>.</p>
 
637
<p>If <i>size</i> is -1 (the default), it is taken to be qstrlen(<i>str</i>).</p>
 
638
<p>If a codec has been set using <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>(), it is used to convert <i>str</i> to Unicode; otherwise this function does the same as <a href="qstring.html#fromLatin1">fromLatin1</a>().</p>
 
639
<p>See also <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>().</p>
 
640
<h3 class="fn"><a name="fromLatin1"></a>QString QString::fromLatin1 ( const char * <i>str</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
641
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the Latin-1 string <i>str</i>.</p>
 
642
<p>If <i>size</i> is -1 (the default), it is taken to be qstrlen(<i>str</i>).</p>
 
643
<p>See also <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>().</p>
 
644
<h3 class="fn"><a name="fromLocal8Bit"></a>QString QString::fromLocal8Bit ( const char * <i>str</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
645
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the 8-bit string <i>str</i>.</p>
 
646
<p>If <i>size</i> is -1 (the default), it is taken to be qstrlen(<i>str</i>).</p>
 
647
<p><a href="qtextcodec.html#codecForLocale">QTextCodec::codecForLocale</a>() is used to perform the conversion from Unicode.</p>
 
648
<p>See also <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
 
649
<h3 class="fn"><a name="fromRawData"></a>QString QString::fromRawData ( const <a href="qchar.html">QChar</a> * <i>unicode</i>, int <i>size</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
650
<p>Constructs a <a href="qstring.html">QString</a> that uses the first <i>size</i> Unicode characters in the array <i>unicode</i>. The data in <i>unicode</i> is <i>not</i> copied. The caller must be able to guarantee that <i>unicode</i> will not be deleted or modified as long as the <a href="qstring.html">QString</a> (or an unmodified copy of it) exists.</p>
 
651
<p>Any attempts to modify the <a href="qstring.html">QString</a> or copies of it will cause it to create a deep copy of the data, ensuring that the raw data isn't modified.</p>
 
652
<p>Here's an example of how we can use a <a href="qregexp.html">QRegExp</a> on raw data in memory without requiring to copy the data into a <a href="qstring.html">QString</a>:</p>
 
653
<pre>&nbsp;   static const QChar unicode[] = {
 
654
        0x005A, 0x007F, 0x00A4, 0x0060, 0x1009, 0x0020,
 
655
        ...
 
656
        0x0020
 
657
    };
 
658
    int size = sizeof(unicode) / sizeof(QChar);
 
659
 
 
660
    QString str = QString::fromRawData(unicode, size);
 
661
    if (str.contains(QRegExp(pattern)))
 
662
    ...</pre>
 
663
<p><b>Warning:</b> A string created with fromRawData() is <i>not</i> '\0'-terminated, unless the raw data contains a '\0' character at position <i>size</i>. This means <a href="qstring.html#unicode">unicode</a>() will <i>not</i> return a '\0'-terminated string (although <a href="qstring.html#utf16">utf16</a>() does, at the cost of copying the raw data).</p>
 
664
<p>See also <a href="qstring.html#fromUtf16">fromUtf16</a>().</p>
 
665
<h3 class="fn"><a name="fromStdString"></a>QString QString::fromStdString ( const std::string &amp; <i>str</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
666
<p>Returns a copy of <i>str</i>. <i>str</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
667
<p>This constructor is only available if Qt is configured with STL compabitility enabled.</p>
 
668
<p>See also <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
 
669
<h3 class="fn"><a name="fromStdWString"></a>QString QString::fromStdWString ( const std::wstring &amp; <i>str</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
670
<p>Returns a copy of <i>str</i>. <i>str</i> is assumed to be encoded in utf16 if the size of wchar_t is 2 bytes (e.g. on windows) and ucs4 if the size of wchar_t is 4 bytes (most Unix systems).</p>
 
671
<p>This constructor is only available if Qt is configured with STL compabitility enabled.</p>
 
672
<p>See also <a href="qstring.html#fromUtf16">fromUtf16</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
 
673
<h3 class="fn"><a name="fromUtf8"></a>QString QString::fromUtf8 ( const char * <i>str</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
674
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> bytes of the UTF-8 string <i>str</i>.</p>
 
675
<p>If <i>size</i> is -1 (the default), it is taken to be qstrlen(<i>str</i>).</p>
 
676
<p>See also <a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>().</p>
 
677
<h3 class="fn"><a name="fromUtf16"></a>QString QString::fromUtf16 ( const <a href="qtglobal.html#ushort-typedef">ushort</a> * <i>unicode</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
678
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the Unicode string <i>unicode</i> (ISO-10646-UTF-16 encoded).</p>
 
679
<p>If <i>size</i> is -1 (the default), <i>unicode</i> must be terminated with a 0.</p>
 
680
<p><a href="qstring.html">QString</a> makes a deep copy of the Unicode data.</p>
 
681
<p>See also <a href="qstring.html#utf16">utf16</a>() and <a href="qstring.html#setUtf16">setUtf16</a>().</p>
 
682
<h3 class="fn"><a name="indexOf"></a>int QString::indexOf ( const QString &amp; <i>str</i>, int <i>from</i> = 0, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
683
<p>Returns the index position of the first occurrence of the string <i>str</i> in this string, searching forward from index position <i>from</i>. Returns -1 if <i>str</i> is not found.</p>
 
684
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
685
<p>Example:</p>
 
686
<pre>&nbsp;   QString x = &quot;sticky question&quot;;
 
687
    QString y = &quot;sti&quot;;
 
688
    x.indexOf(y);               // returns 0
 
689
    x.indexOf(y, 1);            // returns 10
 
690
    x.indexOf(y, 10);           // returns 10
 
691
    x.indexOf(y, 11);           // returns -1</pre>
 
692
<p>If <i>from</i> is -1, the search starts at the last character; if it is -2, at the next to last character and so on.</p>
 
693
<p>See also <a href="qstring.html#lastIndexOf">lastIndexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
 
694
<h3 class="fn"><a name="indexOf-2"></a>int QString::indexOf ( <a href="qchar.html">QChar</a> <i>ch</i>, int <i>from</i> = 0, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
695
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
696
<p>Returns the index position of the first occurrence of the character <i>ch</i> in the string, searching forward from index position <i>from</i>. Returns -1 if <i>ch</i> could not be found.</p>
 
697
<h3 class="fn"><a name="indexOf-3"></a>int QString::indexOf ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i>, int <i>from</i> = 0 ) const</h3>
 
698
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
699
<p>Returns the index position of the first match of the regular expression <i>rx</i> in the string, searching forward from index position <i>from</i>. Returns -1 if <i>rx</i> didn't match anywhere.</p>
 
700
<p>Example:</p>
 
701
<pre>&nbsp;   QString str = &quot;the minimum&quot;;
 
702
    str.indexOf(QRegExp(&quot;m[aeiou]&quot;), 0);       // returns 4</pre>
 
703
<h3 class="fn"><a name="insert"></a>QString &amp; QString::insert ( int <i>i</i>, const QString &amp; <i>str</i> )</h3>
 
704
<p>Inserts the string <i>str</i> at index position <i>i</i> and returns a reference to this string.</p>
 
705
<p>Example:</p>
 
706
<pre>&nbsp;   QString str = &quot;Meal&quot;;
 
707
    str.insert(1, QString(&quot;ontr&quot;));
 
708
    // str == &quot;Montreal&quot;</pre>
 
709
<p>If <i>i</i> is greater than <a href="qstring.html#size">size</a>(), the array is first extended using <a href="qstring.html#resize">resize</a>().</p>
 
710
<p>See also <a href="qstring.html#append">append</a>(), <a href="qstring.html#prepend">prepend</a>(), <a href="qstring.html#replace">replace</a>(), and <a href="qstring.html#remove">remove</a>().</p>
 
711
<h3 class="fn"><a name="insert-2"></a>QString &amp; QString::insert ( int <i>i</i>, const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>str</i> )</h3>
 
712
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
713
<p>Inserts the Latin-1 string <i>str</i> at index position <i>i</i>.</p>
 
714
<h3 class="fn"><a name="insert-3"></a>QString &amp; QString::insert ( int <i>i</i>, const <a href="qchar.html">QChar</a> * <i>unicode</i>, int <i>size</i> )</h3>
 
715
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
716
<p>Inserts the first <i>size</i> characters of the <a href="qchar.html">QChar</a> array <i>unicode</i> at index position <i>i</i> in the string.</p>
 
717
<h3 class="fn"><a name="insert-4"></a>QString &amp; QString::insert ( int <i>i</i>, <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
718
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
719
<p>Inserts <i>ch</i> at index position <i>i</i> in the string.</p>
 
720
<h3 class="fn"><a name="isEmpty"></a>bool QString::isEmpty () const</h3>
 
721
<p>Returns true if the string has no characters; otherwise returns false.</p>
 
722
<p>Example:</p>
 
723
<pre>&nbsp;   QString().isEmpty();            // returns true
 
724
    QString(&quot;&quot;).isEmpty();          // returns true
 
725
    QString(&quot;x&quot;).isEmpty();         // returns false
 
726
    QString(&quot;abc&quot;).isEmpty();       // returns false</pre>
 
727
<p>See also <a href="qstring.html#size">size</a>().</p>
 
728
<h3 class="fn"><a name="isNull"></a>bool QString::isNull () const</h3>
 
729
<p>Returns true if this string is null; otherwise returns false.</p>
 
730
<p>Example:</p>
 
731
<pre>&nbsp;   QString().isNull();             // returns true
 
732
    QString(&quot;&quot;).isNull();           // returns false
 
733
    QString(&quot;abc&quot;).isNull();        // returns false</pre>
 
734
<p>Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is whether or not a string contains any data, and this can be determined using <a href="qstring.html#isEmpty">isEmpty</a>().</p>
 
735
<p>See also <a href="qstring.html#isEmpty">isEmpty</a>().</p>
 
736
<h3 class="fn"><a name="lastIndexOf"></a>int QString::lastIndexOf ( const QString &amp; <i>str</i>, int <i>from</i> = -1, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
737
<p>Returns the index position of the last occurrence of the string <i>str</i> in this string, searching backward from index position <i>from</i>. If <i>from</i> is -1 (the default), the search starts at the last character; if <i>from</i> is -2, at the next to last character and so on. Returns -1 if <i>str</i> is not found.</p>
 
738
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
739
<p>Example:</p>
 
740
<pre>&nbsp;   QString x = &quot;crazy azimuths&quot;;
 
741
    QString y = &quot;az&quot;;
 
742
    x.lastIndexOf(y);           // returns 6
 
743
    x.lastIndexOf(y, 6);        // returns 6
 
744
    x.lastIndexOf(y, 5);        // returns 2
 
745
    x.lastIndexOf(y, 1);        // returns -1</pre>
 
746
<p>See also <a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
 
747
<h3 class="fn"><a name="lastIndexOf-2"></a>int QString::lastIndexOf ( <a href="qchar.html">QChar</a> <i>ch</i>, int <i>from</i> = -1, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
748
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
749
<p>Returns the index position of the last occurrence of the character <i>ch</i>, searching backward from position <i>from</i>.</p>
 
750
<h3 class="fn"><a name="lastIndexOf-3"></a>int QString::lastIndexOf ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i>, int <i>from</i> = -1 ) const</h3>
 
751
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
752
<p>Returns the index position of the last match of the regular expression <i>rx</i> in the string, searching backward from index position <i>from</i>. Returns -1 if <i>rx</i> didn't match anywhere.</p>
 
753
<p>Example:</p>
 
754
<pre>&nbsp;   QString str = &quot;the minimum&quot;;
 
755
    str.lastIndexOf(QRegExp(&quot;m[aeiou]&quot;));      // returns 8</pre>
 
756
<h3 class="fn"><a name="left"></a>QString QString::left ( int <i>len</i> ) const</h3>
 
757
<p>Returns a substring that contains the <i>len</i> leftmost characters of the string.</p>
 
758
<p>The entire string is returned if <i>len</i> is greater than <a href="qstring.html#size">size</a>() or less than zero.</p>
 
759
<pre>&nbsp;   QString x = &quot;Pineapple&quot;;
 
760
    QString y = x.left(4);      // y == &quot;Pine&quot;</pre>
 
761
<p>See also <a href="qstring.html#right">right</a>(), <a href="qstring.html#mid">mid</a>(), and <a href="qstring.html#startsWith">startsWith</a>().</p>
 
762
<h3 class="fn"><a name="leftJustified"></a>QString QString::leftJustified ( int <i>width</i>, <a href="qchar.html">QChar</a> <i>fill</i> = QLatin1Char( ' ' ), bool <i>truncate</i> = false ) const</h3>
 
763
<p>Returns a string of <a href="qstring.html#size">size</a>() <i>width</i> that contains this string padded by the <i>fill</i> character.</p>
 
764
<p>If <i>truncate</i> is false and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then the returned string is a copy of the string.</p>
 
765
<p>If <i>truncate</i> is true and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then any characters in a copy of the string after position <i>width</i> are removed, and the copy is returned.</p>
 
766
<pre>&nbsp;   QString s = &quot;apple&quot;;
 
767
    QString t = s.leftJustified(8, '.');        // t == &quot;apple...&quot;</pre>
 
768
<p>See also <a href="qstring.html#rightJustified">rightJustified</a>().</p>
 
769
<h3 class="fn"><a name="length"></a>int QString::length () const</h3>
 
770
<p>Same as <a href="qstring.html#size">size</a>().</p>
 
771
<h3 class="fn"><a name="localeAwareCompare"></a>int QString::localeAwareCompare ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
772
<p>Compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
 
773
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
 
774
<p>See also <a href="qstring.html#compare">compare</a>() and <a href="qtextcodec-qt3.html#locale">QTextCodec::locale</a>().</p>
 
775
<h3 class="fn"><a name="localeAwareCompare-2"></a>int QString::localeAwareCompare ( const QString &amp; <i>other</i> ) const</h3>
 
776
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
777
<p>Same as localeAwareCompare(*this, <i>other</i>).</p>
 
778
<h3 class="fn"><a name="mid"></a>QString QString::mid ( int <i>i</i>, int <i>len</i> = -1 ) const</h3>
 
779
<p>Returns a string that contains the <i>len</i> characters of this string, starting at position <i>i</i>.</p>
 
780
<p>Returns an empty string if index <i>i</i> exceeds the length of the string. If there are less than <i>len</i> characters available in the string starting at position <i>i</i>, or if <i>len</i> is -1 (the default), the function returns all characters that are available from position <i>i</i>.</p>
 
781
<p>Example:</p>
 
782
<pre>&nbsp;   QString x = &quot;Nine pineapples&quot;;
 
783
    QString y = x.mid(5, 4);            // y == &quot;pine&quot;
 
784
    QString z = x.mid(5);               // z == &quot;pineapples&quot;</pre>
 
785
<p>See also <a href="qstring.html#left">left</a>() and <a href="qstring.html#right">right</a>().</p>
 
786
<h3 class="fn"><a name="normalized"></a>QString QString::normalized ( <a href="qstring.html#NormalizationForm-enum">NormalizationForm</a> <i>form</i> ) const</h3>
 
787
<p>Returns the string in the given Unicode normalization <i>form</i>.</p>
 
788
<h3 class="fn"><a name="normalized-2"></a>QString QString::normalized ( <a href="qstring.html#NormalizationForm-enum">NormalizationForm</a> <i>form</i>, <a href="qchar.html#UnicodeVersion-enum">QChar::UnicodeVersion</a> <i>version</i> ) const</h3>
 
789
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
790
<p>Returns the string in the given Unicode normalization <i>form</i>, according to the given <i>version</i> of the Unicode standard.</p>
 
791
<h3 class="fn"><a name="number"></a>QString QString::number ( long <i>n</i>, int <i>base</i> = 10 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
792
<p>Returns a string equivalent of the number <i>n</i> to base <i>base</i>, which is 10 by default and must be between 2 and 36.</p>
 
793
<pre>&nbsp;   long a = 63;
 
794
    QString str = QString::number(a, 16);             // str == &quot;3f&quot;
 
795
    QString str = QString::number(a, 16).upper();     // str == &quot;3F&quot;</pre>
 
796
<p>See also <a href="qstring.html#setNum">setNum</a>().</p>
 
797
<h3 class="fn"><a name="number-2"></a>QString QString::number ( <a href="qtglobal.html#ulong-typedef">ulong</a> <i>n</i>, int <i>base</i> = 10 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
798
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
799
<h3 class="fn"><a name="number-3"></a>QString QString::number ( int <i>n</i>, int <i>base</i> = 10 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
800
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
801
<h3 class="fn"><a name="number-4"></a>QString QString::number ( <a href="qtglobal.html#uint-typedef">uint</a> <i>n</i>, int <i>base</i> = 10 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
802
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
803
<h3 class="fn"><a name="number-5"></a>QString QString::number ( <a href="qtglobal.html#qlonglong-typedef">qlonglong</a> <i>n</i>, int <i>base</i> = 10 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
804
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
805
<h3 class="fn"><a name="number-6"></a>QString QString::number ( <a href="qtglobal.html#qulonglong-typedef">qulonglong</a> <i>n</i>, int <i>base</i> = 10 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
806
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
807
<h3 class="fn"><a name="number-7"></a>QString QString::number ( double <i>n</i>, char <i>f</i> = 'g', int <i>prec</i> = 6 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
808
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
809
<p>Argument <i>n</i> is formatted according to the format <i>f</i>, and the precision <i>prec</i>. The format <i>f</i> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See arg() for an explanation of the formats.</p>
 
810
<p>See also <a href="qstring.html#setNum">setNum</a>().</p>
 
811
<h3 class="fn"><a name="prepend"></a>QString &amp; QString::prepend ( const QString &amp; <i>str</i> )</h3>
 
812
<p>Prepends the string <i>str</i> to the beginning of this string and returns a reference to this string.</p>
 
813
<p>Example:</p>
 
814
<pre>&nbsp;   QString x = &quot;ship&quot;;
 
815
    QString y = &quot;air&quot;;
 
816
    x.prepend(y);
 
817
    // x == &quot;airship&quot;</pre>
 
818
<p>See also <a href="qstring.html#append">append</a>() and <a href="qstring.html#insert">insert</a>().</p>
 
819
<h3 class="fn"><a name="prepend-2"></a>QString &amp; QString::prepend ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>str</i> )</h3>
 
820
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
821
<p>Prepends the Latin-1 string <i>str</i> to this string.</p>
 
822
<h3 class="fn"><a name="prepend-3"></a>QString &amp; QString::prepend ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>ba</i> )</h3>
 
823
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
824
<p>Prepends the byte array <i>ba</i> to this string. <i>ba</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
825
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
826
<h3 class="fn"><a name="prepend-4"></a>QString &amp; QString::prepend ( const char * <i>str</i> )</h3>
 
827
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
828
<p>Prepends the string <i>str</i> to this string. <i>str</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
829
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
830
<h3 class="fn"><a name="prepend-5"></a>QString &amp; QString::prepend ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
831
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
832
<p>Prepends the character <i>ch</i> to this string.</p>
 
833
<h3 class="fn"><a name="push_back"></a>void QString::push_back ( const QString &amp; <i>other</i> )</h3>
 
834
<p>This function is provided for STL compatibility. It is equivalent to append(<i>other</i>).</p>
 
835
<h3 class="fn"><a name="push_back-2"></a>void QString::push_back ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
836
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
837
<p>Same as append(<i>ch</i>).</p>
 
838
<h3 class="fn"><a name="push_front"></a>void QString::push_front ( const QString &amp; <i>other</i> )</h3>
 
839
<p>This function is provided for STL compatibility. It is equivalent to prepend(<i>other</i>).</p>
 
840
<h3 class="fn"><a name="push_front-2"></a>void QString::push_front ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
841
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
842
<p>Same as prepend(<i>ch</i>).</p>
 
843
<h3 class="fn"><a name="remove"></a>QString &amp; QString::remove ( int <i>pos</i>, int <i>len</i> )</h3>
 
844
<p>Removes <i>len</i> characters from the string, starting at index position <i>pos</i>, and returns a reference to the string.</p>
 
845
<p>If <i>pos</i> is within the string, but <i>pos</i> + <i>len</i> is beyond the end of the string, the string is truncated at position <i>pos</i>.</p>
 
846
<pre>&nbsp;   QString str = &quot;Montreal&quot;;
 
847
    str.remove(1, 4);
 
848
    // str == &quot;Meal&quot;</pre>
 
849
<p>See also <a href="qstring.html#insert">insert</a>() and <a href="qstring.html#replace">replace</a>().</p>
 
850
<h3 class="fn"><a name="remove-4"></a>QString &amp; QString::remove ( const QString &amp; <i>str</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive )</h3>
 
851
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
852
<p>Removes every occurrence of <i>str</i> in this string. Returns a reference to this string.</p>
 
853
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
854
<p>This is the same as replace(<i>str</i>, &quot;&quot;, <i>cs</i>).</p>
 
855
<h3 class="fn"><a name="remove-5"></a>QString &amp; QString::remove ( <a href="qchar.html">QChar</a> <i>ch</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive )</h3>
 
856
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
857
<p>Removes every occurrence of the character <i>ch</i> in this string, and returns a reference to this string.</p>
 
858
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
859
<p>Example:</p>
 
860
<pre>&nbsp;   QString str = &quot;Ali Baba&quot;;
 
861
    str.remove(QChar('a'), Qt::CaseInsensitive);
 
862
    // str == &quot;li Bb&quot;</pre>
 
863
<p>This is the same as replace(<i>ch</i>, &quot;&quot;, <i>cs</i>).</p>
 
864
<h3 class="fn"><a name="remove-6"></a>QString &amp; QString::remove ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i> )</h3>
 
865
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
866
<p>Removes every occurrence of the regular expression <i>rx</i> in the string, and returns a reference to the string. For example:</p>
 
867
<pre>&nbsp;   QString str = &quot;Telephone&quot;;
 
868
    str.remove(QRegExp(&quot;[aeiou].&quot;));
 
869
    // str == &quot;The&quot;</pre>
 
870
<p>See also <a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#lastIndexOf">lastIndexOf</a>(), and <a href="qstring.html#replace">replace</a>().</p>
 
871
<h3 class="fn"><a name="replace"></a>QString &amp; QString::replace ( int <i>pos</i>, int <i>len</i>, const QString &amp; <i>after</i> )</h3>
 
872
<p>Replaces <i>len</i> characters from index position <i>pos</i> with the string <i>after</i>, and returns a reference to this string.</p>
 
873
<p>Example:</p>
 
874
<pre>&nbsp;   QString x = &quot;Say yes!&quot;;
 
875
    QString y = &quot;no&quot;;
 
876
    x.replace(4, 3, y);
 
877
    // x == &quot;Say no!&quot;</pre>
 
878
<p>See also <a href="qstring.html#insert">insert</a>() and <a href="qstring.html#remove">remove</a>().</p>
 
879
<h3 class="fn"><a name="replace-6"></a>QString &amp; QString::replace ( int <i>pos</i>, int <i>len</i>, const <a href="qchar.html">QChar</a> * <i>unicode</i>, int <i>size</i> )</h3>
 
880
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
881
<p>Replaces <i>len</i> characters from index position <i>pos</i> with the first <i>size</i> characters of the <a href="qchar.html">QChar</a> array <i>unicode</i>.</p>
 
882
<h3 class="fn"><a name="replace-7"></a>QString &amp; QString::replace ( int <i>pos</i>, int <i>len</i>, <a href="qchar.html">QChar</a> <i>after</i> )</h3>
 
883
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
884
<p>Replaces <i>len</i> characters from index position <i>pos</i> with the character <i>after</i>.</p>
 
885
<h3 class="fn"><a name="replace-8"></a>QString &amp; QString::replace ( const QString &amp; <i>before</i>, const QString &amp; <i>after</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive )</h3>
 
886
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
887
<p>Replaces every occurrence of the string <i>before</i> with the string <i>after</i>.</p>
 
888
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
889
<p>Example:</p>
 
890
<pre>&nbsp;   QString str = &quot;colour behaviour flavour neighbour&quot;;
 
891
    str.replace(QString(&quot;ou&quot;), QString(&quot;o&quot;));
 
892
    // str == &quot;color behavior flavor neighbor&quot;</pre>
 
893
<h3 class="fn"><a name="replace-9"></a>QString &amp; QString::replace ( <a href="qchar.html">QChar</a> <i>ch</i>, const QString &amp; <i>after</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive )</h3>
 
894
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
895
<p>Replaces every occurrence of the character <i>ch</i> in the string with <i>after</i>. Returns a reference to the string.</p>
 
896
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
897
<h3 class="fn"><a name="replace-10"></a>QString &amp; QString::replace ( <a href="qchar.html">QChar</a> <i>before</i>, <a href="qchar.html">QChar</a> <i>after</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive )</h3>
 
898
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
899
<p>Replaces every occurrence of the character <i>before</i> with the character <i>after</i>. Returns a reference to the string.</p>
 
900
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
901
<h3 class="fn"><a name="replace-11"></a>QString &amp; QString::replace ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i>, const QString &amp; <i>after</i> )</h3>
 
902
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
903
<p>Replaces every occurrence of the regular expression <i>rx</i> in the string with <i>after</i>. Returns a reference to the string. For example:</p>
 
904
<pre>&nbsp;   QString str = &quot;Banana&quot;;
 
905
    str.replace(QRegExp(&quot;a[mn]&quot;), &quot;ox&quot;);
 
906
    // str == &quot;Boxoxa&quot;</pre>
 
907
<p>For regular expressions containing <a href="qregexp.html#capturing-parentheses">capturing parentheses</a>, occurrences of <b>\1</b>, <b>\2</b>, ..., in <i>after</i> are replaced with <i>rx</i>.cap(1), cap(2), ...</p>
 
908
<pre>&nbsp;   QString str = &quot;A &lt;i&gt;bon mot&lt;/i&gt;.&quot;;
 
909
    str.replace(QRegExp(&quot;&lt;i&gt;([^&lt;]*)&lt;/i&gt;&quot;), &quot;\\emph{\\1}&quot;);
 
910
    // str == &quot;A \\emph{bon mot}.&quot;</pre>
 
911
<p>See also <a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#lastIndexOf">lastIndexOf</a>(), <a href="qstring.html#remove">remove</a>(), and <a href="qregexp.html#cap">QRegExp::cap</a>().</p>
 
912
<h3 class="fn"><a name="reserve"></a>void QString::reserve ( int <i>size</i> )</h3>
 
913
<p>Attempts to allocate memory for at least <i>size</i> characters. If you know in advance how large the string will be, you can call this function, and if you resize the string often you are likely to get better performance. If <i>size</i> is an underestimate, the worst that will happen is that the <a href="qstring.html">QString</a> will be a bit slower.</p>
 
914
<p>The sole purpose of this function is to provide a means of fine tuning <a href="qstring.html">QString</a>'s memory usage. In general, you will rarely ever need to call this function. If you want to change the size of the string, call <a href="qstring.html#resize">resize</a>().</p>
 
915
<p>This function is useful for code that needs to build up a long string and wants to avoid repeated reallocation. In this example, we want to add to the string until some condition is true, and we're fairly sure that size is large enough to make a call to reserve() worthwhile:</p>
 
916
<pre>&nbsp;   QString result;
 
917
    int len = 0;
 
918
    result.reserve(maxSize);
 
919
    while (...) {
 
920
        result[len++] = getNextChar(); // fill part of the space
 
921
    }
 
922
    result.squeeze();</pre>
 
923
<p>See also <a href="qstring.html#squeeze">squeeze</a>() and <a href="qstring.html#capacity">capacity</a>().</p>
 
924
<h3 class="fn"><a name="resize"></a>void QString::resize ( int <i>size</i> )</h3>
 
925
<p>Sets the size of the string to <i>size</i> characters.</p>
 
926
<p>If <i>size</i> is greater than the current size, the string is extended to make it <i>size</i> characters long with the extra characters added to the end. The new characters are uninitialized.</p>
 
927
<p>If <i>size</i> is less than the current size, characters are removed from the end.</p>
 
928
<p>Example:</p>
 
929
<pre>&nbsp;   QString str = &quot;Hello world&quot;;
 
930
    str.resize(5);
 
931
    // str == &quot;Hello&quot;
 
932
 
 
933
    str.resize(8);
 
934
    // str == &quot;Hello???&quot; (where ? stands for any character)</pre>
 
935
<p>If you want to append a certain number of identical characters to the string, use operator+=() as follows rather than resize():</p>
 
936
<pre>&nbsp;   QString str = &quot;Hello&quot;;
 
937
    str += QString(10, 'X');
 
938
    // str == &quot;HelloXXXXXXXXXX&quot;</pre>
 
939
<p>If you want to expand the string so that it reaches a certain width and fill the new positions with a particular character, use <a href="qstring.html#leftJustified">leftJustified</a>():</p>
 
940
<pre>&nbsp;   QString str = &quot;Hello&quot;;
 
941
    str = str.leftJustified(10, ' ');
 
942
    // str == &quot;Hello     &quot;</pre>
 
943
<p>See also <a href="qstring.html#truncate">truncate</a>() and <a href="qstring.html#reserve">reserve</a>().</p>
 
944
<h3 class="fn"><a name="right"></a>QString QString::right ( int <i>len</i> ) const</h3>
 
945
<p>Returns a substring that contains the <i>len</i> rightmost characters of the string.</p>
 
946
<p>The entire string is returned if <i>len</i> is greater than <a href="qstring.html#size">size</a>() or less than zero.</p>
 
947
<pre>&nbsp;   QString x = &quot;Pineapple&quot;;
 
948
    QString y = x.right(5);     // y == &quot;apple&quot;</pre>
 
949
<p>See also <a href="qstring.html#left">left</a>(), <a href="qstring.html#mid">mid</a>(), and <a href="qstring.html#endsWith">endsWith</a>().</p>
 
950
<h3 class="fn"><a name="rightJustified"></a>QString QString::rightJustified ( int <i>width</i>, <a href="qchar.html">QChar</a> <i>fill</i> = QLatin1Char( ' ' ), bool <i>truncate</i> = false ) const</h3>
 
951
<p>Returns a string of <a href="qstring.html#size">size</a>() <i>width</i> that contains the <i>fill</i> character followed by the string.</p>
 
952
<p>If <i>truncate</i> is false and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then the returned string is a copy of the string.</p>
 
953
<p>If <i>truncate</i> is true and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then the resulting string is truncated at position <i>width</i>.</p>
 
954
<pre>&nbsp;   QString str = &quot;apple&quot;;
 
955
    str = str.rightJustified(8, '.');
 
956
    // str == &quot;...apple&quot;</pre>
 
957
<p>See also <a href="qstring.html#leftJustified">leftJustified</a>().</p>
 
958
<h3 class="fn"><a name="section"></a>QString QString::section ( <a href="qchar.html">QChar</a> <i>sep</i>, int <i>start</i>, int <i>end</i> = -1, <a href="qstring.html#SectionFlag-enum">SectionFlags</a> <i>flags</i> = SectionDefault ) const</h3>
 
959
<p>This function returns a section of the string.</p>
 
960
<p>This string is treated as a sequence of fields separated by the character, <i>sep</i>. The returned string consists of the fields from position <i>start</i> to position <i>end</i> inclusive. If <i>end</i> is not specified, all fields from position <i>start</i> to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left.</p>
 
961
<p>The <i>flags</i> argument can be used to affect some aspects of the function's behavior, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see <a href="qstring.html#SectionFlag-enum">SectionFlags</a>.</p>
 
962
<pre>&nbsp;   QString csv = &quot;forename,middlename,surname,phone&quot;;
 
963
    QString str = csv.section(',', 2, 2);   // str == &quot;surname&quot;
 
964
 
 
965
    QString path = &quot;/usr/local/bin/myapp&quot;; // First field is empty
 
966
    QString str = path.section('/', 3, 4);  // str == &quot;bin/myapp&quot;
 
967
    QString str = path.section('/', 3, 3, SectionSkipEmpty); // str == &quot;myapp&quot;</pre>
 
968
<p>If <i>start</i> or <i>end</i> is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.</p>
 
969
<pre>&nbsp;   QString csv = &quot;forename,middlename,surname,phone&quot;;
 
970
    QString str = csv.section(',', -3, -2);  // str == &quot;middlename,surname&quot;
 
971
 
 
972
    QString path = &quot;/usr/local/bin/myapp&quot;; // First field is empty
 
973
    QString str = path.section('/', -1); // str == &quot;myapp&quot;</pre>
 
974
<p>See also <a href="qstring.html#split">split</a>().</p>
 
975
<h3 class="fn"><a name="section-2"></a>QString QString::section ( const QString &amp; <i>sep</i>, int <i>start</i>, int <i>end</i> = -1, <a href="qstring.html#SectionFlag-enum">SectionFlags</a> <i>flags</i> = SectionDefault ) const</h3>
 
976
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
977
<pre>&nbsp;   QString data = &quot;forename**middlename**surname**phone&quot;;
 
978
    QString str = data.section(&quot;**&quot;, 2, 2); // str == &quot;surname&quot;</pre>
 
979
<pre>&nbsp;   QString data = &quot;forename**middlename**surname**phone&quot;;
 
980
    QString str = data.section(&quot;**&quot;, -3, -2); // str == &quot;middlename**surname&quot;</pre>
 
981
<p>See also <a href="qstring.html#split">split</a>().</p>
 
982
<h3 class="fn"><a name="section-3"></a>QString QString::section ( const <a href="qregexp.html">QRegExp</a> &amp; <i>reg</i>, int <i>start</i>, int <i>end</i> = -1, <a href="qstring.html#SectionFlag-enum">SectionFlags</a> <i>flags</i> = SectionDefault ) const</h3>
 
983
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
984
<p>This string is treated as a sequence of fields separated by the regular expression, <i>reg</i>.</p>
 
985
<pre>&nbsp;   QString line = &quot;forename\tmiddlename  surname \t \t phone&quot;;
 
986
    QRegExp sep(&quot;\\s+&quot;);
 
987
    QString s = line.section(sep, 2, 2); // s == &quot;surname&quot;</pre>
 
988
<pre>&nbsp;   QString line = &quot;forename\tmiddlename  surname \t \t phone&quot;;
 
989
    QRegExp sep(&quot;\\s+&quot;);
 
990
    QString s = line.section(sep, -3, -2); // s == &quot;middlename  surname&quot;</pre>
 
991
<p><b>Warning:</b> Using this <a href="qregexp.html">QRegExp</a> version is much more expensive than the overloaded string and character versions.</p>
 
992
<p>See also <a href="qstring.html#split">split</a>() and <a href="qstring.html#simplified">simplified</a>().</p>
 
993
<h3 class="fn"><a name="setNum"></a>QString &amp; QString::setNum ( int <i>n</i>, int <i>base</i> = 10 )</h3>
 
994
<p>Sets the string to the printed value of <i>n</i> in base <i>base</i> and returns a reference to the string.</p>
 
995
<p>The base is 10 by default and must be between 2 and 36.</p>
 
996
<pre>&nbsp;   QString str;
 
997
    str.setNum(1234);       // str == &quot;1234&quot;</pre>
 
998
<h3 class="fn"><a name="setNum-2"></a>QString &amp; QString::setNum ( <a href="qtglobal.html#uint-typedef">uint</a> <i>n</i>, int <i>base</i> = 10 )</h3>
 
999
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1000
<h3 class="fn"><a name="setNum-3"></a>QString &amp; QString::setNum ( long <i>n</i>, int <i>base</i> = 10 )</h3>
 
1001
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1002
<h3 class="fn"><a name="setNum-4"></a>QString &amp; QString::setNum ( <a href="qtglobal.html#ulong-typedef">ulong</a> <i>n</i>, int <i>base</i> = 10 )</h3>
 
1003
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1004
<h3 class="fn"><a name="setNum-5"></a>QString &amp; QString::setNum ( <a href="qtglobal.html#qlonglong-typedef">qlonglong</a> <i>n</i>, int <i>base</i> = 10 )</h3>
 
1005
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1006
<h3 class="fn"><a name="setNum-6"></a>QString &amp; QString::setNum ( <a href="qtglobal.html#qulonglong-typedef">qulonglong</a> <i>n</i>, int <i>base</i> = 10 )</h3>
 
1007
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1008
<h3 class="fn"><a name="setNum-7"></a>QString &amp; QString::setNum ( short <i>n</i>, int <i>base</i> = 10 )</h3>
 
1009
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1010
<h3 class="fn"><a name="setNum-8"></a>QString &amp; QString::setNum ( <a href="qtglobal.html#ushort-typedef">ushort</a> <i>n</i>, int <i>base</i> = 10 )</h3>
 
1011
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1012
<h3 class="fn"><a name="setNum-9"></a>QString &amp; QString::setNum ( double <i>n</i>, char <i>f</i> = 'g', int <i>prec</i> = 6 )</h3>
 
1013
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1014
<p>Sets the string to the printed value of <i>n</i>, formatted using format <i>f</i> with precision <i>prec</i>, and returns a reference to the string.</p>
 
1015
<p>The format <i>f</i> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See arg() for an explanation of the formats.</p>
 
1016
<h3 class="fn"><a name="setNum-10"></a>QString &amp; QString::setNum ( float <i>n</i>, char <i>f</i> = 'g', int <i>prec</i> = 6 )</h3>
 
1017
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1018
<p>Sets the string to the printed value of <i>n</i>, formatted in format <i>f</i> with precision <i>prec</i>, and returns a reference to the string.</p>
 
1019
<p>The format <i>f</i> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See arg() for an explanation of the formats.</p>
 
1020
<h3 class="fn"><a name="setUnicode"></a>QString &amp; QString::setUnicode ( const <a href="qchar.html">QChar</a> * <i>unicode</i>, int <i>size</i> )</h3>
 
1021
<p>Resizes the string to <i>size</i> characters and copies <i>unicode</i> into the string.</p>
 
1022
<p>If <i>unicode</i> is 0, nothing is copied, but the string is still resized to <i>size</i>.</p>
 
1023
<p>See also <a href="qstring.html#unicode">unicode</a>() and <a href="qstring.html#setUtf16">setUtf16</a>().</p>
 
1024
<h3 class="fn"><a name="setUtf16"></a>QString &amp; QString::setUtf16 ( const <a href="qtglobal.html#ushort-typedef">ushort</a> * <i>unicode</i>, int <i>size</i> )</h3>
 
1025
<p>Resizes the string to <i>size</i> characters and copies <i>unicode</i> into the string.</p>
 
1026
<p>If <i>unicode</i> is 0, nothing is copied, but the string is still resized to <i>size</i>.</p>
 
1027
<p>See also <a href="qstring.html#utf16">utf16</a>() and <a href="qstring.html#setUnicode">setUnicode</a>().</p>
 
1028
<h3 class="fn"><a name="simplified"></a>QString QString::simplified () const</h3>
 
1029
<p>Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.</p>
 
1030
<p>Whitespace means any character for which <a href="qchar.html#isSpace">QChar::isSpace</a>() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.</p>
 
1031
<p>Example:</p>
 
1032
<pre>&nbsp;   QString str = &quot;  lots\t of\nwhitespace\r\n &quot;;
 
1033
    str = str.trimmed();
 
1034
    // str == &quot;lots of whitespace&quot;;</pre>
 
1035
<p>See also <a href="qstring.html#trimmed">trimmed</a>().</p>
 
1036
<h3 class="fn"><a name="size"></a>int QString::size () const</h3>
 
1037
<p>Returns the number of characters in this string.</p>
 
1038
<p>The last character in the string is at position size() - 1. In addition, <a href="qstring.html">QString</a> ensures that the character at position size() is always '\0', so that you can use the return value of <a href="qstring.html#data">data</a>() and <a href="qstring.html#constData">constData</a>() as arguments to functions that expect '\0'-terminated strings.</p>
 
1039
<p>Example:</p>
 
1040
<pre>&nbsp;   QString str = &quot;World&quot;;
 
1041
    int n = str.size();         // n == 5
 
1042
    str.data()[0];              // returns 'W'
 
1043
    str.data()[4];              // returns 'd'
 
1044
    str.data()[5];              // returns '\0'</pre>
 
1045
<p>See also <a href="qstring.html#isEmpty">isEmpty</a>() and <a href="qstring.html#resize">resize</a>().</p>
 
1046
<h3 class="fn"><a name="split"></a><a href="qstringlist.html">QStringList</a> QString::split ( const QString &amp; <i>sep</i>, <a href="qstring.html#SplitBehavior-enum">SplitBehavior</a> <i>behavior</i> = KeepEmptyParts, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
1047
<p>Splits the string into substrings wherever <i>sep</i> occurs, and returns the list of those strings. If <i>sep</i> does not match anywhere in the string, split() returns a single-element list containing this string.</p>
 
1048
<p>If <i>cs</i> is true, the string is only split only where characters are found that match <i>sep</i> exactly. If <i>cs</i> is false, the string is split, the string is split where characters are found that match <i>sep</i> case insensitively (e.g. &quot;and&quot; matches &quot;AND&quot;).</p>
 
1049
<p>If <i>behavior</i> is <a href="qstring.html#SplitBehavior-enum">QString::SkipEmptyParts</a>, empty entries don't appear in the result. By default, empty entries are kept.</p>
 
1050
<p>Example:</p>
 
1051
<pre>&nbsp;   QString str = &quot;a,,b,c&quot;;
 
1052
    QStringList list1 = str.split(&quot;,&quot;);
 
1053
    // list1: [ &quot;a&quot;, &quot;&quot;, &quot;b&quot;, &quot;c&quot; ]
 
1054
 
 
1055
    QStringList list2 = str.split(&quot;,&quot;, QString::SkipEmptyParts);
 
1056
    // list2: [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot; ]</pre>
 
1057
<p>See also <a href="qstringlist.html#join">QStringList::join</a>() and <a href="qstring.html#section">section</a>().</p>
 
1058
<h3 class="fn"><a name="split-2"></a><a href="qstringlist.html">QStringList</a> QString::split ( const <a href="qchar.html">QChar</a> &amp; <i>sep</i>, <a href="qstring.html#SplitBehavior-enum">SplitBehavior</a> <i>behavior</i> = KeepEmptyParts, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
1059
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1060
<h3 class="fn"><a name="split-3"></a><a href="qstringlist.html">QStringList</a> QString::split ( const <a href="qregexp.html">QRegExp</a> &amp; <i>rx</i>, <a href="qstring.html#SplitBehavior-enum">SplitBehavior</a> <i>behavior</i> = KeepEmptyParts ) const</h3>
 
1061
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1062
<p>Splits the string into substrings wherever the regular expression <i>rx</i> matches, and returns the list of those strings. If <i>rx</i> does not match anywhere in the string, <a href="qstring.html#split">split</a>() returns a single-element list containing this string.</p>
 
1063
<p>Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator:</p>
 
1064
<pre>&nbsp;   QString str = &quot;Some  text\n\twith  strange whitespace.&quot;;
 
1065
    QStringList list = str.split(QRegExp(&quot;\\s+&quot;));
 
1066
    // list: [ &quot;Some&quot;, &quot;text&quot;, &quot;with&quot;, &quot;strange&quot;, &quot;whitespace.&quot; ]</pre>
 
1067
<p>Here's a similar example, but this time we use any sequence of non-word characters as the separator:</p>
 
1068
<pre>&nbsp;   QString str = &quot;This time, a normal English sentence.&quot;;
 
1069
    QStringList list = str.split(QRegExp(&quot;\\W+&quot;),
 
1070
                                 QString::SkipEmptyParts);
 
1071
    // list: [ &quot;This&quot;, &quot;time&quot;, &quot;a&quot;, &quot;normal&quot;, &quot;English&quot;, &quot;sentence&quot; ]</pre>
 
1072
<p>Here's a third example where we use a zero-length assertion, <b>\b</b> (word boundary), to split the string into an alternating sequence of non-word and word tokens:</p>
 
1073
<pre>&nbsp;   QString str = &quot;Now: this sentence fragment.&quot;;
 
1074
    QStringList list = str.split(QRegExp(&quot;\\b&quot;));
 
1075
    // list: [ &quot;&quot;, &quot;Now&quot;, &quot;: &quot;, &quot;this&quot;, &quot; &quot;, &quot;sentence&quot;, &quot; &quot;, &quot;fragment&quot;, &quot;.&quot; ]</pre>
 
1076
<p>See also <a href="qstringlist.html#join">QStringList::join</a>() and <a href="qstring.html#section">section</a>().</p>
 
1077
<h3 class="fn"><a name="sprintf"></a>QString &amp; QString::sprintf ( const char * <i>cformat</i>, ... )</h3>
 
1078
<p>Safely builds a formatted string from the format string <i>cformat</i> and an arbitrary list of arguments.</p>
 
1079
<p>The %lc escape sequence expects a unicode character of type ushort (as returned by <a href="qchar.html#unicode">QChar::unicode</a>()). The %ls escape sequence expects a pointer to a zero-terminated array of unicode characters of type ushort (as returned by <a href="qstring.html#utf16">QString::utf16</a>()).</p>
 
1080
<p>The format string supports most of the conversion specifiers provided by printf() in the standard C++ library. It doesn't honor the length modifiers (e.g. <tt>h</tt> for <tt>short</tt>, <tt>ll</tt> for <tt>long long</tt>). If you need those, use the standard sprintf() function instead:</p>
 
1081
<pre>&nbsp;   char buf[BufSize];
 
1082
    ::sprintf(buf, &quot;%lld&quot;, 123456789LL);
 
1083
    QString str = QString::fromAscii(buf);</pre>
 
1084
<p><b>Warning:</b> We do not recommend using QString::sprintf() in new Qt code. Instead, consider using <a href="qtextostream.html">QTextOStream</a> or <a href="qstring.html#arg">arg</a>(), both of which support Unicode strings seamlessly and are type-safe. Here's an example that uses <a href="qtextostream.html">QTextOStream</a>:</p>
 
1085
<pre>&nbsp;   QString result;
 
1086
    QTextOStream(&amp;result) &lt;&lt; &quot;pi = &quot; &lt;&lt; 3.14;
 
1087
    // result == &quot;pi = 3.14&quot;</pre>
 
1088
<p>For <a href="qobject.html#tr">translations,</a> especially if the strings contains more than one escape sequence, you should consider using the <a href="qstring.html#arg">arg</a>() function instead. This allows the order of the replacements to be controlled by the translator.</p>
 
1089
<p>See also <a href="qstring.html#arg">arg</a>().</p>
 
1090
<h3 class="fn"><a name="squeeze"></a>void QString::squeeze ()</h3>
 
1091
<p>Releases any memory not required to store the character data.</p>
 
1092
<p>The sole purpose of this function is to provide a means of fine tuning <a href="qstring.html">QString</a>'s memory usage. In general, you will rarely ever need to call this function.</p>
 
1093
<p>See also <a href="qstring.html#reserve">reserve</a>() and <a href="qstring.html#capacity">capacity</a>().</p>
 
1094
<h3 class="fn"><a name="startsWith"></a>bool QString::startsWith ( const QString &amp; <i>s</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
1095
<p>Returns true if the string starts with <i>s</i>; otherwise returns false.</p>
 
1096
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (the default), the search is case sensitive; otherwise the search is case insensitive.</p>
 
1097
<pre>&nbsp;   QString str = &quot;Bananas&quot;;
 
1098
    str.startsWith(&quot;Ban&quot;);     // returns true
 
1099
    str.startsWith(&quot;Car&quot;);     // returns false</pre>
 
1100
<p>See also <a href="qstring.html#endsWith">endsWith</a>().</p>
 
1101
<h3 class="fn"><a name="startsWith-3"></a>bool QString::startsWith ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>s</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
1102
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1103
<h3 class="fn"><a name="startsWith-4"></a>bool QString::startsWith ( const <a href="qchar.html">QChar</a> &amp; <i>c</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) const</h3>
 
1104
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1105
<h3 class="fn"><a name="toAscii"></a><a href="qbytearray.html">QByteArray</a> QString::toAscii () const</h3>
 
1106
<p>Returns an 8-bit ASCII representation of the string as a <a href="qbytearray.html">QByteArray</a>.</p>
 
1107
<p>If a codec has been set using <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>(), it is used to convert Unicode to 8-bit char; otherwise this function does the same as <a href="qstring.html#toLatin1">toLatin1</a>().</p>
 
1108
<p>See also <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
 
1109
<h3 class="fn"><a name="toDouble"></a>double QString::toDouble ( bool * <i>ok</i> = 0 ) const</h3>
 
1110
<p>Returns the string converted to a <tt>double</tt> value.</p>
 
1111
<p>Returns 0.0 if the conversion fails.</p>
 
1112
<p>If <i>ok</i> is not 0: if a conversion error occurs, <tt>*</tt><i>ok</i> is set to false; otherwise <tt>*</tt><i>ok</i> is set to true.</p>
 
1113
<pre>&nbsp;   QString str = &quot;1234.56&quot;;
 
1114
    double val = str.toDouble();   // val == 1234.56</pre>
 
1115
<p>This function tries to interpret the string according to the current locale. The current locale is determined from the system at application startup and can be changed by calling <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). If the string cannot be interpreted according to the current locale, this function falls back on the &quot;C&quot; locale.</p>
 
1116
<pre>&nbsp;   bool ok;
 
1117
    double d;
 
1118
 
 
1119
    QLocale::setDefault(QLocale::C);
 
1120
    d = QString( &quot;1234,56&quot; ).toDouble(&amp;ok); // ok == false
 
1121
    d = QString( &quot;1234.56&quot; ).toDouble(&amp;ok); // ok == true, d == 1234.56
 
1122
 
 
1123
    QLocale::setDefault(QLocale::German);
 
1124
    d = QString( &quot;1234,56&quot; ).toDouble(&amp;ok); // ok == true, d == 1234.56
 
1125
    d = QString( &quot;1234.56&quot; ).toDouble(&amp;ok); // ok == true, d == 1234.56</pre>
 
1126
<p>Due to the ambiguity between the decimal point and thousands group separator in various locales, this function does not handle thousands group separators. If you need to convert such numbers, see <a href="qlocale.html#toDouble">QLocale::toDouble</a>().</p>
 
1127
<pre>&nbsp;   bool ok;
 
1128
    QLocale::setDefault(QLocale::C);
 
1129
    double d = QString( &quot;1,234,567.89&quot; ).toDouble(&amp;ok); // ok == false</pre>
 
1130
<p><b>Warning:</b> If the string contains trailing whitespace this function will fail, and set <tt>*</tt><i>ok</i> to false if <i>ok</i> is not 0. Leading whitespace is ignored.</p>
 
1131
<p>See also <a href="qstring.html#number">number</a>(), <a href="qlocale.html#setDefault">QLocale::setDefault</a>(), <a href="qlocale.html#toDouble">QLocale::toDouble</a>(), and <a href="qstring.html#trimmed">trimmed</a>().</p>
 
1132
<h3 class="fn"><a name="toFloat"></a>float QString::toFloat ( bool * <i>ok</i> = 0 ) const</h3>
 
1133
<p>Returns the string converted to a <tt>float</tt> value.</p>
 
1134
<p>Returns 0.0 if the conversion fails.</p>
 
1135
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1136
<p>Example:</p>
 
1137
<pre>&nbsp;   QString str1 = &quot;1234.56&quot;;
 
1138
    str1.toFloat();             // returns 1234.56
 
1139
 
 
1140
    bool ok;
 
1141
    QString str2 = &quot;R2D2&quot;;
 
1142
    str2.toFloat(&amp;ok);          // returns 0.0, sets ok to false</pre>
 
1143
<p>See also <a href="qstring.html#number">number</a>(), <a href="qstring.html#toDouble">toDouble</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
 
1144
<h3 class="fn"><a name="toInt"></a>int QString::toInt ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1145
<p>Returns the string converted to an <tt>int</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1146
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1147
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1148
<p>Example:</p>
 
1149
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1150
    bool ok;
 
1151
    int hex = str.toInt(&amp;ok, 16);       // hex == 255, ok == true
 
1152
    int dec = str.toInt(&amp;ok, 10);       // dec == 0, ok == false</pre>
 
1153
<p>See also <a href="qstring.html#number">number</a>(), <a href="qstring.html#toUInt">toUInt</a>(), and <a href="qstring.html#toDouble">toDouble</a>().</p>
 
1154
<h3 class="fn"><a name="toLatin1"></a><a href="qbytearray.html">QByteArray</a> QString::toLatin1 () const</h3>
 
1155
<p>Returns a Latin-1 representation of the string as a <a href="qbytearray.html">QByteArray</a>. The returned byte array is undefined if the string contains non-Latin1 characters.</p>
 
1156
<p>See also <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
 
1157
<h3 class="fn"><a name="toLocal8Bit"></a><a href="qbytearray.html">QByteArray</a> QString::toLocal8Bit () const</h3>
 
1158
<p>Returns the local 8-bit representation of the string as a <a href="qbytearray.html">QByteArray</a>. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.</p>
 
1159
<p><a href="qtextcodec.html#codecForLocale">QTextCodec::codecForLocale</a>() is used to perform the conversion from Unicode.</p>
 
1160
<p>See also <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
 
1161
<h3 class="fn"><a name="toLong"></a>long QString::toLong ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1162
<p>Returns the string converted to a <tt>long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1163
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1164
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1165
<p>Example:</p>
 
1166
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1167
    bool ok;
 
1168
    long hex = str.toLong(&amp;ok, 16);     // hex == 255, ok == true
 
1169
    long dec = str.toLong(&amp;ok, 10);     // dec == 0, ok == false</pre>
 
1170
<p>See also <a href="qstring.html#number">number</a>(), <a href="qstring.html#toULong">toULong</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
 
1171
<h3 class="fn"><a name="toLongLong"></a><a href="qtglobal.html#qlonglong-typedef">qlonglong</a> QString::toLongLong ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1172
<p>Returns the string converted to a <tt>long long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1173
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1174
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1175
<p>Example:</p>
 
1176
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1177
    bool ok;
 
1178
    qint64 hex = str.toLongLong(&amp;ok, 16);      // hex == 255, ok == true
 
1179
    qint64 dec = str.toLongLong(&amp;ok, 10);      // dec == 0, ok == false</pre>
 
1180
<p>See also <a href="qstring.html#number">number</a>(), <a href="qstring.html#toULongLong">toULongLong</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
 
1181
<h3 class="fn"><a name="toLower"></a>QString QString::toLower () const</h3>
 
1182
<p>Returns a lowercase copy of the string.</p>
 
1183
<pre>&nbsp;   QString str = &quot;TROlltECH&quot;;
 
1184
    str = str.toLower();        // str == &quot;trolltech&quot;</pre>
 
1185
<p>See also <a href="qstring.html#toUpper">toUpper</a>().</p>
 
1186
<h3 class="fn"><a name="toShort"></a>short QString::toShort ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1187
<p>Returns the string converted to a <tt>short</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1188
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1189
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1190
<p>Example:</p>
 
1191
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1192
    bool ok;
 
1193
    short hex = str.toShort(&amp;ok, 16);   // hex == 255, ok == true
 
1194
    short dec = str.toShort(&amp;ok, 10);   // dec == 0, ok == false</pre>
 
1195
<p>See also <a href="qstring.html#number">number</a>(), <a href="qstring.html#toUShort">toUShort</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
 
1196
<h3 class="fn"><a name="toStdString"></a>std::string QString::toStdString () const</h3>
 
1197
<p>Returns a std::string object with the data contained in this <a href="qstring.html">QString</a>. The Unicode data is converted into 8-bit characters using <a href="qstring.html#toAscii">toAscii</a>().</p>
 
1198
<p>This operator is mostly useful to pass a <a href="qstring.html">QString</a> to a function that accepts a std::string object.</p>
 
1199
<p>If the <a href="qstring.html">QString</a> contains non-ASCII Unicode characters, using this operator can lead to loss of information. You can disable this operator by defining <tt>QT_NO_CAST_TO_ASCII</tt> when you compile your applications. You then need to call <a href="qstring.html#toAscii">toAscii</a>() (or <a href="qstring.html#toLatin1">toLatin1</a>() or <a href="qstring.html#toUtf8">toUtf8</a>() or <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>()) explicitly if you want to convert the data to <tt>const char *</tt> and pass the return value on to the std::string constructor.</p>
 
1200
<p>This operator is only available if Qt is configured with STL compabitility enabled.</p>
 
1201
<p>See also <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().</p>
 
1202
<h3 class="fn"><a name="toStdWString"></a>std::wstring QString::toStdWString () const</h3>
 
1203
<p>Returns a std::wstring object with the data contained in this <a href="qstring.html">QString</a>. The std::wstring is encoded in utf16 on platforms where wchar_t is 2 bytes wide (e.g. windows) and in ucs4 on platforms where wchar_t is 4 bytes wide (most Unix systems).</p>
 
1204
<p>This operator is mostly useful to pass a <a href="qstring.html">QString</a> to a function that accepts a std::wstring object.</p>
 
1205
<p>This operator is only available if Qt is configured with STL compabitility enabled.</p>
 
1206
<p>See also <a href="qstring.html#utf16">utf16</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().</p>
 
1207
<h3 class="fn"><a name="toUInt"></a><a href="qtglobal.html#uint-typedef">uint</a> QString::toUInt ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1208
<p>Returns the string converted to an <tt>unsigned int</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1209
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1210
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1211
<p>Example:</p>
 
1212
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1213
    bool ok;
 
1214
    uint hex = str.toUInt(&amp;ok, 16);     // hex == 255, ok == true
 
1215
    uint dec = str.toUInt(&amp;ok, 10);     // dec == 0, ok == false</pre>
 
1216
<p>See also <a href="qstring.html#number">number</a>() and <a href="qstring.html#toInt">toInt</a>().</p>
 
1217
<h3 class="fn"><a name="toULong"></a><a href="qtglobal.html#ulong-typedef">ulong</a> QString::toULong ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1218
<p>Returns the string converted to an <tt>unsigned long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1219
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1220
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1221
<p>Example:</p>
 
1222
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1223
    bool ok;
 
1224
    ulong hex = str.toULong(&amp;ok, 16);   // hex == 255, ok == true
 
1225
    ulong dec = str.toULong(&amp;ok, 10);   // dec == 0, ok == false</pre>
 
1226
<p>See also <a href="qstring.html#number">number</a>().</p>
 
1227
<h3 class="fn"><a name="toULongLong"></a><a href="qtglobal.html#qulonglong-typedef">qulonglong</a> QString::toULongLong ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1228
<p>Returns the string converted to an <tt>unsigned long long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1229
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1230
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1231
<p>Example:</p>
 
1232
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1233
    bool ok;
 
1234
    quint64 hex = str.toULongLong(&amp;ok, 16);    // hex == 255, ok == true
 
1235
    quint64 dec = str.toULongLong(&amp;ok, 10);    // dec == 0, ok == false</pre>
 
1236
<p>See also <a href="qstring.html#number">number</a>() and <a href="qstring.html#toLongLong">toLongLong</a>().</p>
 
1237
<h3 class="fn"><a name="toUShort"></a><a href="qtglobal.html#ushort-typedef">ushort</a> QString::toUShort ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</h3>
 
1238
<p>Returns the string converted to an <tt>unsigned short</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
 
1239
<p>If <i>ok</i> is not 0: if a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
 
1240
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
 
1241
<p>Example:</p>
 
1242
<pre>&nbsp;   QString str = &quot;FF&quot;;
 
1243
    bool ok;
 
1244
    ushort hex = str.toUShort(&amp;ok, 16);     // hex == 255, ok == true
 
1245
    ushort dec = str.toUShort(&amp;ok, 10);     // dec == 0, ok == false</pre>
 
1246
<p>See also <a href="qstring.html#number">number</a>() and <a href="qstring.html#toShort">toShort</a>().</p>
 
1247
<h3 class="fn"><a name="toUpper"></a>QString QString::toUpper () const</h3>
 
1248
<p>Returns an uppercase copy of the string.</p>
 
1249
<pre>&nbsp;   QString str = &quot;TeXt&quot;;
 
1250
    str = str.toUpper();        // str == &quot;TEXT&quot;</pre>
 
1251
<p>See also <a href="qstring.html#toLower">toLower</a>().</p>
 
1252
<h3 class="fn"><a name="toUtf8"></a><a href="qbytearray.html">QByteArray</a> QString::toUtf8 () const</h3>
 
1253
<p>Returns a UTF-8 representation of the string as a <a href="qbytearray.html">QByteArray</a>.</p>
 
1254
<p>See also <a href="qstring.html#fromUtf8">fromUtf8</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
 
1255
<h3 class="fn"><a name="trimmed"></a>QString QString::trimmed () const</h3>
 
1256
<p>Returns a string that has whitespace removed from the start and the end.</p>
 
1257
<p>Whitespace means any character for which <a href="qchar.html#isSpace">QChar::isSpace</a>() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.</p>
 
1258
<p>Example:</p>
 
1259
<pre>&nbsp;   QString str = &quot;  lots\t of\nwhitespace\r\n &quot;;
 
1260
    str = str.trimmed();
 
1261
    // str == &quot;lots\t of\nwhitespace&quot;;</pre>
 
1262
<p>Unlike <a href="qstring.html#simplified">simplified</a>(), trimmed() leaves internal whitespace alone.</p>
 
1263
<p>See also <a href="qstring.html#simplified">simplified</a>().</p>
 
1264
<h3 class="fn"><a name="truncate"></a>void QString::truncate ( int <i>pos</i> )</h3>
 
1265
<p>Truncates the string at index position <i>pos</i>.</p>
 
1266
<p>If <i>pos</i> is beyond the end of the string, nothing happens.</p>
 
1267
<p>Example:</p>
 
1268
<pre>&nbsp;   QString str = &quot;Vladivostok&quot;;
 
1269
    str.truncate(4);
 
1270
    // str == &quot;Vlad&quot;</pre>
 
1271
<p>See also <a href="qstring.html#chop">chop</a>(), <a href="qstring.html#resize">resize</a>(), and <a href="qstring.html#left">left</a>().</p>
 
1272
<h3 class="fn"><a name="unicode"></a>const <a href="qchar.html">QChar</a> * QString::unicode () const</h3>
 
1273
<p>Returns a '\0'-terminated Unicode representation of the string. The result remains valid until the string is modified.</p>
 
1274
<p>See also <a href="qstring.html#utf16">utf16</a>().</p>
 
1275
<h3 class="fn"><a name="utf16"></a>const <a href="qtglobal.html#ushort-typedef">ushort</a> * QString::utf16 () const</h3>
 
1276
<p>Returns the <a href="qstring.html">QString</a> as a '\0'-terminated array of unsigned shorts. The result remains valid until the string is modified.</p>
 
1277
<p>See also <a href="qstring.html#unicode">unicode</a>().</p>
 
1278
<h3 class="fn"><a name="vsprintf"></a>QString &amp; QString::vsprintf ( const char * <i>cformat</i>, va_list <i>ap</i> )</h3>
 
1279
<p>Equivalent method to <a href="qstring.html#sprintf">sprintf</a>(), but takes a va_list <i>ap</i> instead a list of variable arguments. See the <a href="qstring.html#sprintf">sprintf</a>() documentation for an explanation of <i>cformat</i>.</p>
 
1280
<p>This method does not call the va_end macro, the caller is responsible to call va_end on <i>ap</i>.</p>
 
1281
<p>See also <a href="qstring.html#sprintf">sprintf</a>().</p>
 
1282
<h3 class="fn"><a name="operator-not-eq"></a>bool QString::operator!= ( const QString &amp; <i>other</i> ) const</h3>
 
1283
<p>Returns true if this string is not equal to string <i>other</i>; otherwise returns false.</p>
 
1284
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
1285
<h3 class="fn"><a name="operator-not-eq-2"></a>bool QString::operator!= ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>other</i> ) const</h3>
 
1286
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1287
<h3 class="fn"><a name="operator-not-eq-3"></a>bool QString::operator!= ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>other</i> ) const</h3>
 
1288
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1289
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1290
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1291
<h3 class="fn"><a name="operator-not-eq-4"></a>bool QString::operator!= ( const char * <i>other</i> ) const</h3>
 
1292
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1293
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1294
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1295
<h3 class="fn"><a name="operator-2b-eq"></a>QString &amp; QString::operator+= ( const QString &amp; <i>other</i> )</h3>
 
1296
<p>Appends the string <i>other</i> onto the end of this string and returns a reference to this string.</p>
 
1297
<p>Example:</p>
 
1298
<pre>&nbsp;   QString x = &quot;free&quot;;
 
1299
    QString y = &quot;dom&quot;;
 
1300
    x += y;
 
1301
    // x == &quot;freedom&quot;</pre>
 
1302
<p>This operation is typically very fast (<a href="containers.html#constant-time">constant time</a>), because <a href="qstring.html">QString</a> preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.</p>
 
1303
<p>See also <a href="qstring.html#append">append</a>() and <a href="qstring.html#prepend">prepend</a>().</p>
 
1304
<h3 class="fn"><a name="operator-2b-eq-2"></a>QString &amp; QString::operator+= ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>str</i> )</h3>
 
1305
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1306
<p>Appends the Latin-1 string <i>str</i> to this string.</p>
 
1307
<h3 class="fn"><a name="operator-2b-eq-3"></a>QString &amp; QString::operator+= ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>ba</i> )</h3>
 
1308
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1309
<p>Appends the byte array <i>ba</i> to this string. <i>ba</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1310
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1311
<h3 class="fn"><a name="operator-2b-eq-4"></a>QString &amp; QString::operator+= ( const char * <i>str</i> )</h3>
 
1312
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1313
<p>Appends the string <i>str</i> to this string. <i>str</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1314
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1315
<h3 class="fn"><a name="operator-2b-eq-5"></a>QString &amp; QString::operator+= ( char <i>ch</i> )</h3>
 
1316
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1317
<p>Appends the character <i>ch</i> to this string. The character is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1318
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1319
<h3 class="fn"><a name="operator-2b-eq-6"></a>QString &amp; QString::operator+= ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
1320
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1321
<p>Appends the character <i>ch</i> to the string.</p>
 
1322
<h3 class="fn"><a name="operator-lt"></a>bool QString::operator&lt; ( const QString &amp; <i>other</i> ) const</h3>
 
1323
<p>Returns true if this string is lexically less than string <i>other</i>; otherwise returns false.</p>
 
1324
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
1325
<h3 class="fn"><a name="operator-lt-2"></a>bool QString::operator&lt; ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>other</i> ) const</h3>
 
1326
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1327
<h3 class="fn"><a name="operator-lt-3"></a>bool QString::operator&lt; ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>other</i> ) const</h3>
 
1328
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1329
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1330
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1331
<h3 class="fn"><a name="operator-lt-4"></a>bool QString::operator&lt; ( const char * <i>other</i> ) const</h3>
 
1332
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1333
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1334
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1335
<h3 class="fn"><a name="operator-lt-eq"></a>bool QString::operator&lt;= ( const QString &amp; <i>other</i> ) const</h3>
 
1336
<p>Returns true if this string is lexically less than or equal to string <i>other</i>; otherwise returns false.</p>
 
1337
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
1338
<h3 class="fn"><a name="operator-lt-eq-2"></a>bool QString::operator&lt;= ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>other</i> ) const</h3>
 
1339
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1340
<h3 class="fn"><a name="operator-lt-eq-3"></a>bool QString::operator&lt;= ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>other</i> ) const</h3>
 
1341
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1342
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1343
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1344
<h3 class="fn"><a name="operator-lt-eq-4"></a>bool QString::operator&lt;= ( const char * <i>other</i> ) const</h3>
 
1345
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1346
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1347
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1348
<h3 class="fn"><a name="operator-eq"></a>QString &amp; QString::operator= ( const QString &amp; <i>other</i> )</h3>
 
1349
<p>Assigns <i>other</i> to this string and returns a reference to this string.</p>
 
1350
<h3 class="fn"><a name="operator-eq-3"></a>QString &amp; QString::operator= ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>str</i> )</h3>
 
1351
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1352
<p>Assigns the Latin-1 string <i>str</i> to this string.</p>
 
1353
<h3 class="fn"><a name="operator-eq-4"></a>QString &amp; QString::operator= ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>ba</i> )</h3>
 
1354
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1355
<p>Assigns <i>ba</i> to this string. <i>ba</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1356
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for exaple.</p>
 
1357
<h3 class="fn"><a name="operator-eq-5"></a>QString &amp; QString::operator= ( const char * <i>str</i> )</h3>
 
1358
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1359
<p>Assigns <i>str</i> to this string. <i>str</i> is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1360
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1361
<h3 class="fn"><a name="operator-eq-6"></a>QString &amp; QString::operator= ( char <i>ch</i> )</h3>
 
1362
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1363
<p>Assigns character <i>ch</i> to this string. The character is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1364
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1365
<h3 class="fn"><a name="operator-eq-7"></a>QString &amp; QString::operator= ( <a href="qchar.html">QChar</a> <i>ch</i> )</h3>
 
1366
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1367
<p>Sets the string to contain the single character <i>ch</i>.</p>
 
1368
<h3 class="fn"><a name="operator-eq-eq"></a>bool QString::operator== ( const QString &amp; <i>other</i> ) const</h3>
 
1369
<p>Returns true if string <i>other</i> is equal to this string; otherwise returns false.</p>
 
1370
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
1371
<h3 class="fn"><a name="operator-eq-eq-2"></a>bool QString::operator== ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>other</i> ) const</h3>
 
1372
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1373
<h3 class="fn"><a name="operator-eq-eq-3"></a>bool QString::operator== ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>other</i> ) const</h3>
 
1374
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1375
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1376
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1377
<h3 class="fn"><a name="operator-eq-eq-4"></a>bool QString::operator== ( const char * <i>other</i> ) const</h3>
 
1378
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1379
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1380
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1381
<h3 class="fn"><a name="operator-gt"></a>bool QString::operator&gt; ( const QString &amp; <i>other</i> ) const</h3>
 
1382
<p>Returns true if this string is lexically greater than string <i>other</i>; otherwise returns false.</p>
 
1383
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
1384
<h3 class="fn"><a name="operator-gt-2"></a>bool QString::operator&gt; ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>other</i> ) const</h3>
 
1385
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1386
<h3 class="fn"><a name="operator-gt-3"></a>bool QString::operator&gt; ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>other</i> ) const</h3>
 
1387
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1388
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1389
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1390
<h3 class="fn"><a name="operator-gt-4"></a>bool QString::operator&gt; ( const char * <i>other</i> ) const</h3>
 
1391
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1392
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1393
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1394
<h3 class="fn"><a name="operator-gt-eq"></a>bool QString::operator&gt;= ( const QString &amp; <i>other</i> ) const</h3>
 
1395
<p>Returns true if this string is lexically greater than or equal to string <i>other</i>; otherwise returns false.</p>
 
1396
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
 
1397
<h3 class="fn"><a name="operator-gt-eq-2"></a>bool QString::operator&gt;= ( const <a href="qlatin1string.html">QLatin1String</a> &amp; <i>other</i> ) const</h3>
 
1398
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1399
<h3 class="fn"><a name="operator-gt-eq-3"></a>bool QString::operator&gt;= ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>other</i> ) const</h3>
 
1400
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1401
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1402
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1403
<h3 class="fn"><a name="operator-gt-eq-4"></a>bool QString::operator&gt;= ( const char * <i>other</i> ) const</h3>
 
1404
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1405
<p><i>other</i> is converted to a <a href="qstring.html">QString</a> using <a href="qstring.html#fromAscii">fromAscii</a>().</p>
 
1406
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
 
1407
<h3 class="fn"><a name="operator-5b-5d"></a><a href="qcharref.html">QCharRef</a> QString::operator[] ( int <i>i</i> )</h3>
 
1408
<p>Returns the character at index position <i>i</i> as a modifiable reference.</p>
 
1409
<p>Example:</p>
 
1410
<pre>&nbsp;   if (str[0] == QChar('?'))
 
1411
        str[0] = QChar('_');</pre>
 
1412
<p>The return value is of type <a href="qcharref.html">QCharRef</a>, a helper class for <a href="qstring.html">QString</a>. When you get an object of type <a href="qcharref.html">QCharRef</a>, you can use it as if it were a <a href="qchar.html">QChar</a> &amp;. If you assign to it, the assignment will apply to the character in the <a href="qstring.html">QString</a> from which you got the reference.</p>
 
1413
<p>See also <a href="qstring.html#at">at</a>().</p>
 
1414
<h3 class="fn"><a name="operator-5b-5d-2"></a>const <a href="qchar.html">QChar</a> QString::operator[] ( int <i>i</i> ) const</h3>
 
1415
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1416
<p>Same as at(<i>i</i>).</p>
 
1417
<h3 class="fn"><a name="operator-5b-5d-3"></a><a href="qcharref.html">QCharRef</a> QString::operator[] ( <a href="qtglobal.html#uint-typedef">uint</a> <i>i</i> )</h3>
 
1418
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1419
<h3 class="fn"><a name="operator-5b-5d-4"></a>const <a href="qchar.html">QChar</a> QString::operator[] ( <a href="qtglobal.html#uint-typedef">uint</a> <i>i</i> ) const</h3>
 
1420
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1421
<hr />
 
1422
<h2>Related Non-Members</h2>
 
1423
<h3 class="fn"><a name="operator-not-eq-30"></a>bool operator!= ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1424
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1425
<p>Returns true if <i>s1</i> is not equal to <i>s2</i>; otherwise returns false. Note that no string is equal to <i>s1</i> being 0.</p>
 
1426
<p>For <i>s1</i> != 0, this is equivalent to compare(<i>s1</i>, <i>s2</i>) != 0.</p>
 
1427
<h3 class="fn"><a name="operator-2b-7"></a>const QString operator+ ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1428
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1429
<p>Returns a string which is the result of concatenating the string <i>s1</i> and the string <i>s2</i>.</p>
 
1430
<h3 class="fn"><a name="operator-2b-20"></a>const QString operator+ ( const QString &amp; <i>s1</i>, const char * <i>s2</i> )</h3>
 
1431
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1432
<p>Returns a string which is the result of concatenating the string <i>s1</i> and the string <i>s2</i>. <i>s2</i> is converted to Unicode using fromAscii().</p>
 
1433
<h3 class="fn"><a name="operator-2b-21"></a>const QString operator+ ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1434
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1435
<p>Returns a string which is the result of concatenating the string <i>s1</i> and string <i>s2</i>. <i>s1</i> is converted to Unicode using fromAscii().</p>
 
1436
<h3 class="fn"><a name="operator-2b-22"></a>const QString operator+ ( const QString &amp; <i>s</i>, char <i>ch</i> )</h3>
 
1437
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1438
<p>Returns a string which is the result of concatenating the string <i>s</i> and character <i>ch</i>.</p>
 
1439
<h3 class="fn"><a name="operator-2b-23"></a>const QString operator+ ( char <i>ch</i>, const QString &amp; <i>s</i> )</h3>
 
1440
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1441
<p>Returns a string which is the result of concatenating the character <i>ch</i> and string <i>s</i>.</p>
 
1442
<h3 class="fn"><a name="operator-lt-11"></a>bool operator&lt; ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1443
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1444
<p>Returns true if <i>s1</i> is lexically less than <i>s2</i>; otherwise returns false.</p>
 
1445
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p>
 
1446
<p>For <i>s1</i> != 0, equivalent to compare(<i>s1</i>, <i>s2</i>) &lt; 0.</p>
 
1447
<h3 class="fn"><a name="operator-lt-lt-52"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>out</i>, const QString &amp; <i>str</i> )</h3>
 
1448
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1449
<p>Writes the string <i>str</i> to the stream <i>out</i>.</p>
 
1450
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
 
1451
<h3 class="fn"><a name="operator-lt-eq-11"></a>bool operator&lt;= ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1452
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1453
<p>Returns true if <i>s1</i> is lexically less than or equal to <i>s2</i>; otherwise returns false.</p>
 
1454
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p>
 
1455
<p>For <i>s1</i> != 0, this is equivalent to compare(<i>s1</i>, <i>s2</i>) &lt;= 0.</p>
 
1456
<h3 class="fn"><a name="operator-eq-eq-40"></a>bool operator== ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1457
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1458
<p>Returns true if <i>s1</i> is equal to <i>s2</i>; otherwise returns false. Note that no string is equal to <i>s1</i> being 0.</p>
 
1459
<p>Equivalent to <i>s1</i> != 0 &amp;&amp; compare(<i>s1</i>, <i>s2</i>) == 0.</p>
 
1460
<h3 class="fn"><a name="operator-gt-11"></a>bool operator&gt; ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1461
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1462
<p>Returns true if <i>s1</i> is lexically greater than <i>s2</i>; otherwise returns false.</p>
 
1463
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p>
 
1464
<p>Equivalent to compare(<i>s1</i>, <i>s2</i>) &gt; 0.</p>
 
1465
<h3 class="fn"><a name="operator-gt-eq-11"></a>bool operator&gt;= ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</h3>
 
1466
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1467
<p>Returns true if <i>s1</i> is lexically greater than or equal to <i>s2</i>; otherwise returns false.</p>
 
1468
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p>
 
1469
<p>For <i>s1</i> != 0, this is equivalent to compare(<i>s1</i>, <i>s2</i>) &gt;= 0.</p>
 
1470
<h3 class="fn"><a name="operator-gt-gt-33"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>in</i>, QString &amp; <i>str</i> )</h3>
 
1471
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
1472
<p>Reads a string from the stream <i>in</i> into string <i>str</i>.</p>
 
1473
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
 
1474
<p /><address><hr /><div align="center">
 
1475
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
1476
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
1477
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
1478
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
1479
</tr></table></div></address></body>
 
1480
</html>