source: trunk/doc/html/qcstring.html

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

reference documentation added

File size: 63.7 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qcstring.cpp:567 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QCString Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QCString Class Reference</h1>
33
34<p>The QCString class provides an abstraction of the classic C
35zero-terminated char array (char *).
36<a href="#details">More...</a>
37<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
38<p><tt>#include &lt;<a href="qcstring-h.html">qcstring.h</a>&gt;</tt>
39<p>Inherits <a href="qbytearray.html">QByteArray</a>.
40<p><a href="qcstring-members.html">List of all member functions.</a>
41<h2>Public Members</h2>
42<ul>
43<li class=fn><a href="#QCString"><b>QCString</b></a> ()</li>
44<li class=fn><a href="#QCString-2"><b>QCString</b></a> ( int&nbsp;size )</li>
45<li class=fn><a href="#QCString-3"><b>QCString</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s )</li>
46<li class=fn><a href="#QCString-4"><b>QCString</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
47<li class=fn><a href="#QCString-5"><b>QCString</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, uint&nbsp;maxsize )</li>
48<li class=fn>QCString &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s )</li>
49<li class=fn>QCString &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
50<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
51<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
52<li class=fn>uint <a href="#length"><b>length</b></a> () const</li>
53<li class=fn>bool <a href="#resize"><b>resize</b></a> ( uint&nbsp;len )</li>
54<li class=fn>bool <a href="#truncate"><b>truncate</b></a> ( uint&nbsp;pos )</li>
55<li class=fn>bool <a href="#fill"><b>fill</b></a> ( char&nbsp;c, int&nbsp;len = -1 )</li>
56<li class=fn>QCString <a href="#copy"><b>copy</b></a> () const</li>
57<li class=fn>QCString &amp; <a href="#sprintf"><b>sprintf</b></a> ( const&nbsp;char&nbsp;*&nbsp;format, ... )</li>
58<li class=fn>int <a href="#find"><b>find</b></a> ( char&nbsp;c, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const</li>
59<li class=fn>int <a href="#find-2"><b>find</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const</li>
60<li class=fn>int <a href="#find-3"><b>find</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx, int&nbsp;index = 0 ) const</li>
61<li class=fn>int <a href="#findRev"><b>findRev</b></a> ( char&nbsp;c, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const</li>
62<li class=fn>int <a href="#findRev-2"><b>findRev</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const</li>
63<li class=fn>int <a href="#findRev-3"><b>findRev</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx, int&nbsp;index = -1 ) const</li>
64<li class=fn>int <a href="#contains"><b>contains</b></a> ( char&nbsp;c, bool&nbsp;cs = TRUE ) const</li>
65<li class=fn>int <a href="#contains-2"><b>contains</b></a> ( const&nbsp;char&nbsp;*&nbsp;str, bool&nbsp;cs = TRUE ) const</li>
66<li class=fn>int <a href="#contains-3"><b>contains</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx ) const</li>
67<li class=fn>QCString <a href="#left"><b>left</b></a> ( uint&nbsp;len ) const</li>
68<li class=fn>QCString <a href="#right"><b>right</b></a> ( uint&nbsp;len ) const</li>
69<li class=fn>QCString <a href="#mid"><b>mid</b></a> ( uint&nbsp;index, uint&nbsp;len = 0xffffffff ) const</li>
70<li class=fn>QCString <a href="#leftJustify"><b>leftJustify</b></a> ( uint&nbsp;width, char&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const</li>
71<li class=fn>QCString <a href="#rightJustify"><b>rightJustify</b></a> ( uint&nbsp;width, char&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const</li>
72<li class=fn>QCString <a href="#lower"><b>lower</b></a> () const</li>
73<li class=fn>QCString <a href="#upper"><b>upper</b></a> () const</li>
74<li class=fn>QCString <a href="#stripWhiteSpace"><b>stripWhiteSpace</b></a> () const</li>
75<li class=fn>QCString <a href="#simplifyWhiteSpace"><b>simplifyWhiteSpace</b></a> () const</li>
76<li class=fn>QCString &amp; <a href="#insert-2"><b>insert</b></a> ( uint&nbsp;index, const&nbsp;char&nbsp;*&nbsp;s )</li>
77<li class=fn>QCString &amp; <a href="#insert"><b>insert</b></a> ( uint&nbsp;index, char&nbsp;c )</li>
78<li class=fn>QCString &amp; <a href="#append"><b>append</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
79<li class=fn>QCString &amp; <a href="#prepend"><b>prepend</b></a> ( const&nbsp;char&nbsp;*&nbsp;s )</li>
80<li class=fn>QCString &amp; <a href="#remove"><b>remove</b></a> ( uint&nbsp;index, uint&nbsp;len )</li>
81<li class=fn>QCString &amp; <a href="#replace"><b>replace</b></a> ( uint&nbsp;index, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;str )</li>
82<li class=fn>QCString &amp; <a href="#replace-2"><b>replace</b></a> ( const&nbsp;QRegExp&nbsp;&amp;&nbsp;rx, const&nbsp;char&nbsp;*&nbsp;str )</li>
83<li class=fn>QCString &amp; <a href="#replace-3"><b>replace</b></a> ( char&nbsp;c, const&nbsp;char&nbsp;*&nbsp;after )</li>
84<li class=fn>QCString &amp; <a href="#replace-4"><b>replace</b></a> ( const&nbsp;char&nbsp;*&nbsp;before, const&nbsp;char&nbsp;*&nbsp;after )</li>
85<li class=fn>QCString &amp; <a href="#replace-5"><b>replace</b></a> ( char&nbsp;c1, char&nbsp;c2 )</li>
86<li class=fn>short <a href="#toShort"><b>toShort</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
87<li class=fn>ushort <a href="#toUShort"><b>toUShort</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
88<li class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
89<li class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
90<li class=fn>long <a href="#toLong"><b>toLong</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
91<li class=fn>ulong <a href="#toULong"><b>toULong</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
92<li class=fn>float <a href="#toFloat"><b>toFloat</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
93<li class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</li>
94<li class=fn>QCString &amp; <a href="#setStr"><b>setStr</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
95<li class=fn>QCString &amp; <a href="#setNum-2"><b>setNum</b></a> ( short&nbsp;n )</li>
96<li class=fn>QCString &amp; <a href="#setNum-3"><b>setNum</b></a> ( ushort&nbsp;n )</li>
97<li class=fn>QCString &amp; <a href="#setNum-4"><b>setNum</b></a> ( int&nbsp;n )</li>
98<li class=fn>QCString &amp; <a href="#setNum-5"><b>setNum</b></a> ( uint&nbsp;n )</li>
99<li class=fn>QCString &amp; <a href="#setNum-6"><b>setNum</b></a> ( long&nbsp;n )</li>
100<li class=fn>QCString &amp; <a href="#setNum-7"><b>setNum</b></a> ( ulong&nbsp;n )</li>
101<li class=fn>QCString &amp; <a href="#setNum-8"><b>setNum</b></a> ( float&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )</li>
102<li class=fn>QCString &amp; <a href="#setNum"><b>setNum</b></a> ( double&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )</li>
103<li class=fn>bool <a href="#setExpand"><b>setExpand</b></a> ( uint&nbsp;index, char&nbsp;c )</li>
104<li class=fn><a href="#operator-const-char-*"><b>operator const char *</b></a> () const</li>
105<li class=fn>QCString &amp; <a href="#operator+-eq"><b>operator+=</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
106<li class=fn>QCString &amp; <a href="#operator+-eq-2"><b>operator+=</b></a> ( char&nbsp;c )</li>
107</ul>
108<h2>Related Functions</h2>
109<ul>
110<li class=fn>void * <a href="#qmemmove"><b>qmemmove</b></a> ( void&nbsp;*&nbsp;dst, const&nbsp;void&nbsp;*&nbsp;src, uint&nbsp;len )</li>
111<li class=fn>char * <a href="#qstrdup"><b>qstrdup</b></a> ( const&nbsp;char&nbsp;*&nbsp;src )</li>
112<li class=fn>char * <a href="#qstrcpy"><b>qstrcpy</b></a> ( char&nbsp;*&nbsp;dst, const&nbsp;char&nbsp;*&nbsp;src )</li>
113<li class=fn>char * <a href="#qstrncpy"><b>qstrncpy</b></a> ( char&nbsp;*&nbsp;dst, const&nbsp;char&nbsp;*&nbsp;src, uint&nbsp;len )</li>
114<li class=fn>uint <a href="#qstrlen"><b>qstrlen</b></a> ( const&nbsp;char&nbsp;*&nbsp;str )</li>
115<li class=fn>int <a href="#qstrcmp"><b>qstrcmp</b></a> ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2 )</li>
116<li class=fn>int <a href="#qstrncmp"><b>qstrncmp</b></a> ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2, uint&nbsp;len )</li>
117<li class=fn>int <a href="#qstricmp"><b>qstricmp</b></a> ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2 )</li>
118<li class=fn>int <a href="#qstrnicmp"><b>qstrnicmp</b></a> ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2, uint&nbsp;len )</li>
119<li class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QCString&nbsp;&amp;&nbsp;str )</li>
120<li class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QCString&nbsp;&amp;&nbsp;str )</li>
121<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
122<li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
123<li class=fn>bool <a href="#operator-eq-eq-3"><b>operator==</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
124<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
125<li class=fn>bool <a href="#operator!-eq-2"><b>operator!=</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
126<li class=fn>bool <a href="#operator!-eq-3"><b>operator!=</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
127<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
128<li class=fn>bool <a href="#operator-lt-2"><b>operator&lt;</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
129<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
130<li class=fn>bool <a href="#operator-lt-eq-2"><b>operator&lt;=</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
131<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
132<li class=fn>bool <a href="#operator-gt-2"><b>operator&gt;</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
133<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
134<li class=fn>bool <a href="#operator-gt-eq-2"><b>operator&gt;=</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
135<li class=fn>const QCString <a href="#operator+"><b>operator+</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
136<li class=fn>const QCString <a href="#operator+-2"><b>operator+</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )</li>
137<li class=fn>const QCString <a href="#operator+-3"><b>operator+</b></a> ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;QCString&nbsp;&amp;&nbsp;s2 )</li>
138<li class=fn>const QCString <a href="#operator+-4"><b>operator+</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;s, char&nbsp;c )</li>
139<li class=fn>const QCString <a href="#operator+-5"><b>operator+</b></a> ( char&nbsp;c, const&nbsp;QCString&nbsp;&amp;&nbsp;s )</li>
140</ul>
141<hr><a name="details"></a><h2>Detailed Description</h2>
142
143
144
145The QCString class provides an abstraction of the classic C
146zero-terminated char array (char *).
147<p>
148
149
150
151<p> QCString inherits <a href="qbytearray.html">QByteArray</a>, which is defined as
152<a href="qmemarray.html">QMemArray</a>&lt;char&gt;. Since QCString is a QMemArray, it uses <a href="shclass.html">explicit sharing</a> with a reference count.
153<p> QCString tries to behave like a more convenient <tt>const char *</tt>.
154The price of doing this is that some algorithms will perform
155badly. For example, <a href="#append">append</a>() is O(length()) since it scans for a
156null terminator. Although you might use QCString for text that is
157never exposed to the user, for most purposes, and especially for
158user-visible text, you should use <a href="qstring.html">QString</a>. QString provides
159<a href="shclass.html#implicit-sharing">implicit sharing</a>, Unicode and other <a href="i18n.html#internationalization">internationalization</a> support,
160and is well optimized.
161<p> Note that for the QCString methods that take a <tt>const char *</tt>
162parameter the <tt>const char *</tt> must either be 0 (null) or not-null
163and '&#92;0' (NUL byte) terminated; otherwise the results are
164undefined.
165<p> A QCString that has not been assigned to anything is <em>null</em>, i.e.
166both the length and the data pointer is 0. A QCString that
167references the empty string ("", a single '&#92;0' char) is <em>empty</em>.
168Both null and empty QCStrings are legal parameters to the methods.
169Assigning <tt>const char *</tt> 0 to QCString produces a null QCString.
170<p> The <a href="#length">length</a>() function returns the length of the string; <a href="#resize">resize</a>()
171resizes the string and <a href="#truncate">truncate</a>() truncates the string. A string
172can be filled with a character using <a href="#fill">fill</a>(). Strings can be left
173or right padded with characters using <a href="#leftJustify">leftJustify</a>() and
174<a href="#rightJustify">rightJustify</a>(). Characters, strings and regular expressions can be
175searched for using <a href="#find">find</a>() and <a href="#findRev">findRev</a>(), and counted using
176<a href="#contains">contains</a>().
177<p> Strings and characters can be inserted with <a href="#insert">insert</a>() and appended
178with <a href="#append">append</a>(). A string can be prepended with <a href="#prepend">prepend</a>().
179Characters can be removed from the string with <a href="#remove">remove</a>() and
180replaced with <a href="#replace">replace</a>().
181<p> Portions of a string can be extracted using <a href="#left">left</a>(), <a href="#right">right</a>() and
182<a href="#mid">mid</a>(). Whitespace can be removed using <a href="#stripWhiteSpace">stripWhiteSpace</a>() and
183<a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>(). Strings can be converted to uppercase or
184lowercase with <a href="#upper">upper</a>() and <a href="#lower">lower</a>() respectively.
185<p> Strings that contain numbers can be converted to numbers with
186<a href="#toShort">toShort</a>(), <a href="#toInt">toInt</a>(), <a href="#toLong">toLong</a>(), <a href="#toULong">toULong</a>(), <a href="#toFloat">toFloat</a>() and <a href="#toDouble">toDouble</a>().
187Numbers can be converted to strings with <a href="#setNum">setNum</a>().
188<p> Many operators are overloaded to work with QCStrings. QCString
189also supports some more obscure functions, e.g. <a href="#sprintf">sprintf</a>(),
190<a href="#setStr">setStr</a>() and <a href="#setExpand">setExpand</a>().
191<p> <a name="asciinotion"></a>
192<blockquote><p align="center"><b> Note on Character Comparisons
193</b>
194<p><p> In QCString the notion of uppercase and lowercase and of which
195character is greater than or less than another character is locale
196dependent. This affects functions which support a case insensitive
197option or which compare or lowercase or uppercase their arguments.
198Case insensitive operations and comparisons will be accurate if
199both strings contain only ASCII characters. (If <tt>$LC_CTYPE</tt> is
200set, most Unix systems do "the right thing".) Functions that this
201affects include <a href="#contains">contains</a>(), <a href="#find">find</a>(), <a href="#findRev">findRev</a>(), <a href="#operator-lt">operator&lt;</a>(), <a href="#operator-lt-eq">operator&lt;=</a>(), <a href="#operator-gt">operator&gt;</a>(), <a href="#operator-gt-eq">operator&gt;=</a>(), <a href="#lower">lower</a>() and
202<a href="#upper">upper</a>().
203<p> This issue does not apply to <a href="qstring.html">QString</a>s since they represent
204characters using Unicode.
205</blockquote>
206<p>
207<p> Performance note: The QCString methods for <a href="qregexp.html">QRegExp</a> searching are
208implemented by converting the QCString to a <a href="qstring.html">QString</a> and performing
209the search on that. This implies a <a href="shclass.html#deep-copy">deep copy</a> of the QCString data.
210If you are going to perform many QRegExp searches on a large
211QCString, you will get better performance by converting the
212QCString to a QString yourself, and then searching in the QString.
213<p>See also <a href="collection.html">Collection Classes</a>, <a href="shared.html">Implicitly and Explicitly Shared Classes</a>, <a href="text.html">Text Related Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
214
215<hr><h2>Member Function Documentation</h2>
216<h3 class=fn><a name="QCString"></a>QCString::QCString ()
217</h3>
218
219<p> Constructs a null string.
220<p> <p>See also <a href="#isNull">isNull</a>().
221
222<h3 class=fn><a name="QCString-2"></a>QCString::QCString ( int&nbsp;size )
223</h3>
224Constructs a string with room for <em>size</em> characters, including
225the '&#92;0'-terminator. Makes a null string if <em>size</em> == 0.
226<p> If <em>size</em> &gt; 0, then the first and last characters in the string
227are initialized to '&#92;0'. All other characters are uninitialized.
228<p> <p>See also <a href="#resize">resize</a>() and <a href="#isNull">isNull</a>().
229
230<h3 class=fn><a name="QCString-3"></a>QCString::QCString ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s )
231</h3>
232
233<p> Constructs a <a href="shclass.html#shallow-copy">shallow copy</a> <em>s</em>.
234<p> <p>See also <a href="qmemarray.html#assign">assign</a>().
235
236<h3 class=fn><a name="QCString-4"></a>QCString::QCString ( const&nbsp;char&nbsp;*&nbsp;str )
237</h3>
238Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>.
239<p> If <em>str</em> is 0 a null string is created.
240<p> <p>See also <a href="#isNull">isNull</a>().
241
242<h3 class=fn><a name="QCString-5"></a>QCString::QCString ( const&nbsp;char&nbsp;*&nbsp;str, uint&nbsp;maxsize )
243</h3>
244Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>. The copy will
245be at most <em>maxsize</em> bytes long including the '&#92;0'-terminator.
246<p> Example:
247<pre>
248 QCString str( "helloworld", 6 ); // assigns "hello" to str
249 </pre>
250
251<p> If <em>str</em> contains a 0 byte within the first <em>maxsize</em> bytes, the
252resulting QCString will be terminated by this 0. If <em>str</em> is 0 a
253null string is created.
254<p> <p>See also <a href="#isNull">isNull</a>().
255
256<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="append"></a>QCString::append ( const&nbsp;char&nbsp;*&nbsp;str )
257</h3>
258
259<p> Appends string <em>str</em> to the string and returns a reference to the
260string. Equivalent to <a href="#operator+-eq">operator+=</a>().
261
262<h3 class=fn>int <a name="contains"></a>QCString::contains ( char&nbsp;c, bool&nbsp;cs = TRUE ) const
263</h3>
264Returns the number of times the character <em>c</em> occurs in the
265string.
266<p> The match is case sensitive if <em>cs</em> is TRUE, or case insensitive
267if <em>cs</em> if FALSE.
268<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
269
270<h3 class=fn>int <a name="contains-2"></a>QCString::contains ( const&nbsp;char&nbsp;*&nbsp;str, bool&nbsp;cs = TRUE ) const
271</h3>
272This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
273<p> Returns the number of times <em>str</em> occurs in the string.
274<p> The match is case sensitive if <em>cs</em> is TRUE, or case insensitive
275if <em>cs</em> if FALSE.
276<p> This function counts overlapping substrings, for example, "banana"
277contains two occurrences of "ana".
278<p> <p>See also <a href="#findRev">findRev</a>() and <a href="#asciinotion">Note on character comparisons</a>.
279
280<h3 class=fn>int <a name="contains-3"></a>QCString::contains ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx ) const
281</h3>
282This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
283<p> Counts the number of overlapping occurrences of <em>rx</em> in the string.
284<p> Example:
285<pre>
286 <a href="qstring.html">QString</a> s = "banana and panama";
287 <a href="qregexp.html">QRegExp</a> r = QRegExp( "a[nm]a", TRUE, FALSE );
288 s.<a href="qstring.html#contains">contains</a>( r ); // 4 matches
289 </pre>
290
291<p> <p>See also <a href="#find">find</a>() and <a href="#findRev">findRev</a>().
292
293<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
294string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
295apply the function to that.
296
297<h3 class=fn><a href="qcstring.html">QCString</a> <a name="copy"></a>QCString::copy () const
298</h3>
299
300<p> Returns a <a href="shclass.html#deep-copy">deep copy</a> of this string.
301<p> <p>See also <a href="qmemarray.html#detach">detach</a>().
302
303<h3 class=fn>bool <a name="fill"></a>QCString::fill ( char&nbsp;c, int&nbsp;len = -1 )
304</h3>
305Fills the string with <em>len</em> bytes of character <em>c</em>, followed by
306a '&#92;0'-terminator.
307<p> If <em>len</em> is negative, then the current string length is used.
308<p> Returns FALSE is <em>len</em> is nonnegative and there is not enough
309memory to resize the string; otherwise returns TRUE.
310
311<h3 class=fn>int <a name="find"></a>QCString::find ( char&nbsp;c, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const
312</h3>
313Finds the first occurrence of the character <em>c</em>, starting at
314position <em>index</em>.
315<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
316if <em>cs</em> is FALSE.
317<p> Returns the position of <em>c</em>, or -1 if <em>c</em> could not be found.
318<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
319
320<p>Example: <a href="networkprotocol-example.html#x663">network/networkprotocol/nntp.cpp</a>.
321<h3 class=fn>int <a name="find-2"></a>QCString::find ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = 0, bool&nbsp;cs = TRUE ) const
322</h3>
323This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
324<p> Finds the first occurrence of the string <em>str</em>, starting at
325position <em>index</em>.
326<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
327if <em>cs</em> is FALSE.
328<p> Returns the position of <em>str</em>, or -1 if <em>str</em> could not be
329found.
330<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
331
332<h3 class=fn>int <a name="find-3"></a>QCString::find ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx, int&nbsp;index = 0 ) const
333</h3>
334This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
335<p> Finds the first occurrence of the <a href="qregexp.html#regular-expression">regular expression</a> <em>rx</em>,
336starting at position <em>index</em>.
337<p> Returns the position of the next match, or -1 if <em>rx</em> was not
338found.
339<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
340string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
341apply the function to that.
342
343<h3 class=fn>int <a name="findRev"></a>QCString::findRev ( char&nbsp;c, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const
344</h3>
345Finds the first occurrence of the character <em>c</em>, starting at
346position <em>index</em> and searching backwards.
347<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
348if <em>cs</em> is FALSE.
349<p> Returns the position of <em>c</em>, or -1 if <em>c</em> could not be found.
350<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
351
352<h3 class=fn>int <a name="findRev-2"></a>QCString::findRev ( const&nbsp;char&nbsp;*&nbsp;str, int&nbsp;index = -1, bool&nbsp;cs = TRUE ) const
353</h3>
354This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
355<p> Finds the first occurrence of the string <em>str</em>, starting at
356position <em>index</em> and searching backwards.
357<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
358if <em>cs</em> is FALSE.
359<p> Returns the position of <em>str</em>, or -1 if <em>str</em> could not be
360found.
361<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
362
363<h3 class=fn>int <a name="findRev-3"></a>QCString::findRev ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx, int&nbsp;index = -1 ) const
364</h3>
365This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
366<p> Finds the first occurrence of the <a href="qregexp.html#regular-expression">regular expression</a> <em>rx</em>,
367starting at position <em>index</em> and searching backwards.
368<p> Returns the position of the next match (backwards), or -1 if <em>rx</em>
369was not found.
370<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
371string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
372apply the function to that.
373
374<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="insert"></a>QCString::insert ( uint&nbsp;index, char&nbsp;c )
375</h3>
376Inserts character <em>c</em> into the string at position <em>index</em> and
377returns a reference to the string.
378<p> If <em>index</em> is beyond the end of the string, the string is
379padded with spaces (ASCII 32) to length <em>index</em> and then <em>c</em>
380is appended.
381<p> Example:
382<pre>
383 QCString s = "Yes";
384 s.<a href="#insert">insert</a>( 3, '!'); // s == "Yes!"
385 </pre>
386
387<p> <p>See also <a href="#remove">remove</a>() and <a href="#replace">replace</a>().
388
389<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="insert-2"></a>QCString::insert ( uint&nbsp;index, const&nbsp;char&nbsp;*&nbsp;s )
390</h3>
391This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
392<p> Inserts string <em>s</em> into the string at position <em>index</em>.
393<p> If <em>index</em> is beyond the end of the string, the string is
394padded with spaces (ASCII 32) to length <em>index</em> and then <em>s</em>
395is appended.
396<p> <pre>
397 QCString s = "I like fish";
398 s.<a href="#insert">insert</a>( 2, "don't "); // s == "I don't like fish"
399
400 s = "x"; // index 01234
401 s.<a href="#insert">insert</a>( 3, "yz" ); // s == "x yz"
402 </pre>
403
404
405<h3 class=fn>bool <a name="isEmpty"></a>QCString::isEmpty () const
406</h3>
407
408<p> Returns TRUE if the string is empty, i.e. if <a href="#length">length</a>() == 0;
409otherwise returns FALSE. An empty string is not always a null
410string.
411<p> See example in <a href="#isNull">isNull</a>().
412<p> <p>See also <a href="#isNull">isNull</a>(), <a href="#length">length</a>(), and <a href="qmemarray.html#size">size</a>().
413
414<h3 class=fn>bool <a name="isNull"></a>QCString::isNull () const
415</h3>
416
417<p> Returns TRUE if the string is null, i.e. if <a href="qmemarray.html#data">data</a>() == 0; otherwise
418returns FALSE. A null string is also an empty string.
419<p> Example:
420<pre>
421 QCString a; // a.<a href="qmemarray.html#data">data</a>() == 0, a.<a href="qmemarray.html#size">size</a>() == 0, a.<a href="#length">length</a>() == 0
422 QCString b == ""; // b.<a href="qmemarray.html#data">data</a>() == "", b.<a href="qmemarray.html#size">size</a>() == 1, b.<a href="#length">length</a>() == 0
423 a.<a href="#isNull">isNull</a>(); // TRUE because a.<a href="qmemarray.html#data">data</a>() == 0
424 a.<a href="#isEmpty">isEmpty</a>(); // TRUE because a.<a href="#length">length</a>() == 0
425 b.<a href="#isNull">isNull</a>(); // FALSE because b.<a href="qmemarray.html#data">data</a>() == ""
426 b.<a href="#isEmpty">isEmpty</a>(); // TRUE because b.<a href="#length">length</a>() == 0
427 </pre>
428
429<p> <p>See also <a href="#isEmpty">isEmpty</a>(), <a href="#length">length</a>(), and <a href="qmemarray.html#size">size</a>().
430
431<h3 class=fn><a href="qcstring.html">QCString</a> <a name="left"></a>QCString::left ( uint&nbsp;len ) const
432</h3>
433Returns a substring that contains the <em>len</em> leftmost characters
434of the string.
435<p> The whole string is returned if <em>len</em> exceeds the length of the
436string.
437<p> Example:
438<pre>
439 QCString s = "Pineapple";
440 QCString t = s.<a href="#left">left</a>( 4 ); // t == "Pine"
441 </pre>
442
443<p> <p>See also <a href="#right">right</a>() and <a href="#mid">mid</a>().
444
445<p>Example: <a href="networkprotocol-example.html#x664">network/networkprotocol/nntp.cpp</a>.
446<h3 class=fn><a href="qcstring.html">QCString</a> <a name="leftJustify"></a>QCString::leftJustify ( uint&nbsp;width, char&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const
447</h3>
448Returns a string of length <em>width</em> (plus one for the terminating
449'&#92;0') that contains this string padded with the <em>fill</em> character.
450<p> If the length of the string exceeds <em>width</em> and <em>truncate</em> is
451FALSE (the default), then the returned string is a copy of the
452string. If the length of the string exceeds <em>width</em> and <em>truncate</em> is TRUE, then the returned string is a <a href="#left">left</a>(<em>width</em>).
453<p> Example:
454<pre>
455 QCString s("apple");
456 QCString t = s.<a href="#leftJustify">leftJustify</a>(8, '.'); // t == "apple..."
457 </pre>
458
459<p> <p>See also <a href="#rightJustify">rightJustify</a>().
460
461<h3 class=fn>uint <a name="length"></a>QCString::length () const
462</h3>
463
464<p> Returns the length of the string, excluding the '&#92;0'-terminator.
465Equivalent to calling <tt>strlen(data())</tt>.
466<p> Null strings and empty strings have zero length.
467<p> <p>See also <a href="qmemarray.html#size">size</a>(), <a href="#isNull">isNull</a>(), and <a href="#isEmpty">isEmpty</a>().
468
469<p>Example: <a href="networkprotocol-example.html#x665">network/networkprotocol/nntp.cpp</a>.
470<h3 class=fn><a href="qcstring.html">QCString</a> <a name="lower"></a>QCString::lower () const
471</h3>
472Returns a new string that is a copy of this string converted to lower
473case.
474<p> Example:
475<pre>
476 QCString s("Credit");
477 QCString t = s.<a href="#lower">lower</a>(); // t == "credit"
478 </pre>
479
480<p> <p>See also <a href="#upper">upper</a>() and <a href="#asciinotion">Note on character comparisons</a>.
481
482<h3 class=fn><a href="qcstring.html">QCString</a> <a name="mid"></a>QCString::mid ( uint&nbsp;index, uint&nbsp;len = 0xffffffff ) const
483</h3>
484Returns a substring that contains at most <em>len</em> characters from
485this string, starting at position <em>index</em>.
486<p> Returns a null string if the string is empty or if <em>index</em> is out
487of range. Returns the whole string from <em>index</em> if <em>index+len</em>
488exceeds the length of the string.
489<p> Example:
490<pre>
491 QCString s = "Two pineapples";
492 QCString t = s.<a href="#mid">mid</a>( 4, 3 ); // t == "pin"
493 </pre>
494
495<p> <p>See also <a href="#left">left</a>() and <a href="#right">right</a>().
496
497<p>Example: <a href="networkprotocol-example.html#x666">network/networkprotocol/nntp.cpp</a>.
498<h3 class=fn><a name="operator-const-char-*"></a>QCString::operator const char * () const
499</h3>
500
501<p> Returns the string data.
502
503<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="operator+-eq"></a>QCString::operator+= ( const&nbsp;char&nbsp;*&nbsp;str )
504</h3>
505Appends string <em>str</em> to the string and returns a reference to the string.
506
507<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="operator+-eq-2"></a>QCString::operator+= ( char&nbsp;c )
508</h3>
509This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
510<p> Appends character <em>c</em> to the string and returns a reference to the string.
511
512<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="operator-eq"></a>QCString::operator= ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s )
513</h3>
514
515<p> Assigns a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>s</em> to this string and returns a
516reference to this string.
517
518<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="operator-eq-2"></a>QCString::operator= ( const&nbsp;char&nbsp;*&nbsp;str )
519</h3>
520This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
521<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em> to this string and returns a
522reference to this string.
523<p> If <em>str</em> is 0 a null string is created.
524<p> <p>See also <a href="#isNull">isNull</a>().
525
526<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="prepend"></a>QCString::prepend ( const&nbsp;char&nbsp;*&nbsp;s )
527</h3>
528
529<p> Prepend <em>s</em> to the string. Equivalent to <a href="#insert">insert</a>(0, s).
530<p> <p>See also <a href="#insert">insert</a>().
531
532<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="remove"></a>QCString::remove ( uint&nbsp;index, uint&nbsp;len )
533</h3>
534Removes <em>len</em> characters from the string, starting at position <em>index</em>, and returns a reference to the string.
535<p> If <em>index</em> is out of range, nothing happens. If <em>index</em> is
536valid, but <em>index</em> + <em>len</em> is larger than the length of the
537string, the string is truncated at position <em>index</em>.
538<p> <pre>
539 QCString s = "Montreal";
540 s.<a href="#remove">remove</a>( 1, 4 ); // s == "Meal"
541 </pre>
542
543<p> <p>See also <a href="#insert">insert</a>() and <a href="#replace">replace</a>().
544
545<p>Example: <a href="networkprotocol-example.html#x667">network/networkprotocol/nntp.cpp</a>.
546<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="replace"></a>QCString::replace ( uint&nbsp;index, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;str )
547</h3>
548Replaces <em>len</em> characters from the string, starting at position
549<em>index</em>, with <em>str</em>, and returns a reference to the string.
550<p> If <em>index</em> is out of range, nothing is removed and <em>str</em> is
551appended at the end of the string. If <em>index</em> is valid, but <em>index</em> + <em>len</em> is larger than the length of the string, <em>str</em>
552replaces the rest of the string from position <em>index</em>.
553<p> <pre>
554 QCString s = "Say yes!";
555 s.<a href="#replace">replace</a>( 4, 3, "NO" ); // s == "Say NO!"
556 </pre>
557
558<p> <p>See also <a href="#insert">insert</a>() and <a href="#remove">remove</a>().
559
560<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="replace-2"></a>QCString::replace ( const&nbsp;<a href="qregexp.html">QRegExp</a>&nbsp;&amp;&nbsp;rx, const&nbsp;char&nbsp;*&nbsp;str )
561</h3>
562This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
563<p> Replaces every occurrence of <em>rx</em> in the string with <em>str</em>.
564Returns a reference to the string.
565<p> Example:
566<pre>
567 <a href="qstring.html">QString</a> s = "banana";
568 s.<a href="qstring.html#replace">replace</a>( QRegExp("a.*a"), "" ); // becomes "b"
569
570 s = "banana";
571 s.<a href="qstring.html#replace">replace</a>( QRegExp("^[bn]a"), "X" ); // becomes "Xnana"
572
573 s = "banana";
574 s.<a href="qstring.html#replace">replace</a>( QRegExp("^[bn]a"), "" ); // becomes "nana"
575 </pre>
576
577<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
578string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
579apply the function to that.
580
581<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="replace-3"></a>QCString::replace ( char&nbsp;c, const&nbsp;char&nbsp;*&nbsp;after )
582</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
583<p> Replaces every occurrence of the character <em>c</em> in the string
584with <em>after</em>. Returns a reference to the string.
585<p> Example:
586<pre>
587 QCString s = "a,b,c";
588 s.<a href="#replace">replace</a>( ',', " or " );
589 // s == "a or b or c"
590 </pre>
591
592
593<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="replace-4"></a>QCString::replace ( const&nbsp;char&nbsp;*&nbsp;before, const&nbsp;char&nbsp;*&nbsp;after )
594</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
595<p> Replaces every occurrence of the string <em>before</em> in the string
596with the string <em>after</em>. Returns a reference to the string.
597<p> Example:
598<pre>
599 QCString s = "Greek is Greek";
600 s.<a href="#replace">replace</a>( "Greek", "English" );
601 // s == "English is English"
602 </pre>
603
604
605<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="replace-5"></a>QCString::replace ( char&nbsp;c1, char&nbsp;c2 )
606</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
607<p> Replaces every occurrence of <em>c1</em> with the char <em>c2</em>.
608Returns a reference to the string.
609
610<h3 class=fn>bool <a name="resize"></a>QCString::resize ( uint&nbsp;len )
611</h3>
612Extends or shrinks the string to <em>len</em> bytes, including the
613'&#92;0'-terminator.
614<p> A '&#92;0'-terminator is set at position <tt>len - 1</tt> unless
615<tt>len == 0</tt>.
616<p> Example:
617<pre>
618 QCString s = "resize this string";
619 s.<a href="#resize">resize</a>( 7 ); // s == "resize"
620 </pre>
621
622<p> <p>See also <a href="#truncate">truncate</a>().
623
624<p>Example: <a href="networkprotocol-example.html#x668">network/networkprotocol/nntp.cpp</a>.
625<h3 class=fn><a href="qcstring.html">QCString</a> <a name="right"></a>QCString::right ( uint&nbsp;len ) const
626</h3>
627Returns a substring that contains the <em>len</em> rightmost characters
628of the string.
629<p> The whole string is returned if <em>len</em> exceeds the length of the
630string.
631<p> Example:
632<pre>
633 QCString s = "Pineapple";
634 QCString t = s.<a href="#right">right</a>( 5 ); // t == "apple"
635 </pre>
636
637<p> <p>See also <a href="#left">left</a>() and <a href="#mid">mid</a>().
638
639<p>Example: <a href="networkprotocol-example.html#x669">network/networkprotocol/nntp.cpp</a>.
640<h3 class=fn><a href="qcstring.html">QCString</a> <a name="rightJustify"></a>QCString::rightJustify ( uint&nbsp;width, char&nbsp;fill = ' ', bool&nbsp;truncate = FALSE ) const
641</h3>
642Returns a string of length <em>width</em> (plus one for the terminating
643'&#92;0') that contains zero or more of the <em>fill</em> character followed
644by this string.
645<p> If the length of the string exceeds <em>width</em> and <em>truncate</em> is
646FALSE (the default), then the returned string is a copy of the
647string. If the length of the string exceeds <em>width</em> and <em>truncate</em> is TRUE, then the returned string is a <a href="#left">left</a>(<em>width</em>).
648<p> Example:
649<pre>
650 QCString s("pie");
651 QCString t = s.<a href="#rightJustify">rightJustify</a>(8, '.'); // t == ".....pie"
652 </pre>
653
654<p> <p>See also <a href="#leftJustify">leftJustify</a>().
655
656<h3 class=fn>bool <a name="setExpand"></a>QCString::setExpand ( uint&nbsp;index, char&nbsp;c )
657</h3>
658Sets the character at position <em>index</em> to <em>c</em> and expands the
659string if necessary, padding with spaces.
660<p> Returns FALSE if <em>index</em> was out of range and the string could
661not be expanded; otherwise returns TRUE.
662
663<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum"></a>QCString::setNum ( double&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )
664</h3>
665Sets the string to the string representation of the number <em>n</em>
666and returns a reference to the string.
667<p> The format of the string representation is specified by the format
668character <em>f</em>, and the precision (number of digits after the
669decimal point) is specified with <em>prec</em>.
670<p> The valid formats for <em>f</em> are 'e', 'E', 'f', 'g' and 'G'. The
671formats are the same as for <a href="#sprintf">sprintf</a>(); they are explained in <a href="qstring.html#arg">QString::arg</a>().
672
673<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-2"></a>QCString::setNum ( short&nbsp;n )
674</h3>
675This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
676<p> Sets the string to the string representation of the number <em>n</em>
677and returns a reference to the string.
678
679<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-3"></a>QCString::setNum ( ushort&nbsp;n )
680</h3>
681This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
682<p> Sets the string to the string representation of the number <em>n</em>
683and returns a reference to the string.
684
685<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-4"></a>QCString::setNum ( int&nbsp;n )
686</h3>
687This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
688<p> Sets the string to the string representation of the number <em>n</em>
689and returns a reference to the string.
690
691<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-5"></a>QCString::setNum ( uint&nbsp;n )
692</h3>
693This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
694<p> Sets the string to the string representation of the number <em>n</em>
695and returns a reference to the string.
696
697<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-6"></a>QCString::setNum ( long&nbsp;n )
698</h3>
699This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
700<p> Sets the string to the string representation of the number <em>n</em>
701and returns a reference to the string.
702
703<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-7"></a>QCString::setNum ( ulong&nbsp;n )
704</h3>
705This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
706<p> Sets the string to the string representation of the number <em>n</em>
707and returns a reference to the string.
708
709<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setNum-8"></a>QCString::setNum ( float&nbsp;n, char&nbsp;f = 'g', int&nbsp;prec = 6 )
710</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
711
712<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="setStr"></a>QCString::setStr ( const&nbsp;char&nbsp;*&nbsp;str )
713</h3>
714Makes a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>. Returns a reference to the string.
715
716<h3 class=fn><a href="qcstring.html">QCString</a> <a name="simplifyWhiteSpace"></a>QCString::simplifyWhiteSpace () const
717</h3>
718Returns a new string that has white space removed from the start
719and the end, plus any sequence of internal white space replaced
720with a single space (ASCII 32).
721<p> White space means the decimal ASCII codes 9, 10, 11, 12, 13 and
72232.
723<p> <pre>
724 QCString s = " lots\t of\nwhite space ";
725 QCString t = s.<a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>(); // t == "lots of white space"
726 </pre>
727
728<p> <p>See also <a href="#stripWhiteSpace">stripWhiteSpace</a>().
729
730<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="sprintf"></a>QCString::sprintf ( const&nbsp;char&nbsp;*&nbsp;format, ... )
731</h3>
732Implemented as a call to the native vsprintf() (see the manual for
733your C library).
734<p> If the string is shorter than 256 characters, this <a href="#sprintf">sprintf</a>() calls
735<a href="#resize">resize</a>(256) to decrease the chance of memory corruption. The
736string is resized back to its actual length before sprintf()
737returns.
738<p> Example:
739<pre>
740 QCString s;
741 s.<a href="#sprintf">sprintf</a>( "%d - %s", 1, "first" ); // result &lt; 256 chars
742
743 QCString big( 25000 ); // very long string
744 big.<a href="#sprintf">sprintf</a>( "%d - %s", 2, longString ); // result &lt; 25000 chars
745 </pre>
746
747<p> <b>Warning:</b> All vsprintf() implementations will write past the end of
748the target string (*this) if the <em>format</em> specification and
749arguments happen to be longer than the target string, and some
750will also fail if the target string is longer than some arbitrary
751implementation limit.
752<p> Giving user-supplied arguments to sprintf() is risky: Sooner or
753later someone will paste a huge line into your application.
754
755<h3 class=fn><a href="qcstring.html">QCString</a> <a name="stripWhiteSpace"></a>QCString::stripWhiteSpace () const
756</h3>
757Returns a new string that has white space removed from the start
758and the end.
759<p> White space means the decimal ASCII codes 9, 10, 11, 12, 13 and
76032.
761<p> Example:
762<pre>
763 QCString s = " space ";
764 QCString t = s.<a href="#stripWhiteSpace">stripWhiteSpace</a>(); // t == "space"
765 </pre>
766
767<p> <p>See also <a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>().
768
769<h3 class=fn>double <a name="toDouble"></a>QCString::toDouble ( bool&nbsp;*&nbsp;ok = 0 ) const
770</h3>
771Returns the string converted to a <tt>double</tt> value.
772<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
773number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
774TRUE.
775
776<h3 class=fn>float <a name="toFloat"></a>QCString::toFloat ( bool&nbsp;*&nbsp;ok = 0 ) const
777</h3>
778Returns the string converted to a <tt>float</tt> value.
779<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
780number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
781TRUE.
782
783<h3 class=fn>int <a name="toInt"></a>QCString::toInt ( bool&nbsp;*&nbsp;ok = 0 ) const
784</h3>
785Returns the string converted to a <tt>int</tt> value.
786<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
787number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
788TRUE.
789
790<h3 class=fn>long <a name="toLong"></a>QCString::toLong ( bool&nbsp;*&nbsp;ok = 0 ) const
791</h3>
792Returns the string converted to a <tt>long</tt> value.
793<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
794number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
795TRUE.
796
797<h3 class=fn>short <a name="toShort"></a>QCString::toShort ( bool&nbsp;*&nbsp;ok = 0 ) const
798</h3>
799Returns the string converted to a <tt>short</tt> value.
800<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
801number, is out of range, or if it has trailing garbage; otherwise
802<em>*ok</em> is set to TRUE.
803
804<h3 class=fn>uint <a name="toUInt"></a>QCString::toUInt ( bool&nbsp;*&nbsp;ok = 0 ) const
805</h3>
806Returns the string converted to an <tt>unsigned int</tt> value.
807<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
808number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
809TRUE.
810
811<h3 class=fn>ulong <a name="toULong"></a>QCString::toULong ( bool&nbsp;*&nbsp;ok = 0 ) const
812</h3>
813Returns the string converted to an <tt>unsigned long</tt> value.
814<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
815number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
816TRUE.
817
818<h3 class=fn>ushort <a name="toUShort"></a>QCString::toUShort ( bool&nbsp;*&nbsp;ok = 0 ) const
819</h3>
820Returns the string converted to an <tt>unsigned short</tt> value.
821<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
822number, is out of range, or if it has trailing garbage; otherwise
823<em>*ok</em> is set to TRUE.
824
825<h3 class=fn>bool <a name="truncate"></a>QCString::truncate ( uint&nbsp;pos )
826</h3>
827
828<p> Truncates the string at position <em>pos</em>.
829<p> Equivalent to calling <tt>resize(pos+1)</tt>.
830<p> Example:
831<pre>
832 QCString s = "truncate this string";
833 s.<a href="#truncate">truncate</a>( 5 ); // s == "trunc"
834 </pre>
835
836<p> <p>See also <a href="#resize">resize</a>().
837
838<h3 class=fn><a href="qcstring.html">QCString</a> <a name="upper"></a>QCString::upper () const
839</h3>
840Returns a new string that is a copy of this string converted to upper case.
841<p> Example:
842<pre>
843 QCString s( "Debit" );
844 QCString t = s.<a href="#upper">upper</a>(); // t == "DEBIT"
845 </pre>
846
847<p> <p>See also <a href="#lower">lower</a>() and <a href="#asciinotion">Note on character comparisons</a>.
848
849<hr><h2>Related Functions</h2>
850<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
851</h3>
852
853<p>
854<p> Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
855<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) != 0.
856
857<h3 class=fn>bool <a name="operator!-eq-2"></a>operator!= ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
858</h3>
859This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
860<p>
861<p> Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
862<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) != 0.
863
864<h3 class=fn>bool <a name="operator!-eq-3"></a>operator!= ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
865</h3>
866This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
867<p>
868<p> Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
869<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) != 0.
870
871<h3 class=fn>const&nbsp;<a href="qcstring.html">QCString</a> <a name="operator+"></a>operator+ ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
872</h3>
873
874<p>
875<p> Returns a string which consists of the concatenation of <em>s1</em> and
876<em>s2</em>.
877
878<h3 class=fn>const&nbsp;<a href="qcstring.html">QCString</a> <a name="operator+-2"></a>operator+ ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
879</h3>
880This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
881<p>
882<p> Returns a string which consists of the concatenation of <em>s1</em> and <em>s2</em>.
883
884<h3 class=fn>const&nbsp;<a href="qcstring.html">QCString</a> <a name="operator+-3"></a>operator+ ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
885</h3>
886This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
887<p>
888<p> Returns a string which consists of the concatenation of <em>s1</em> and <em>s2</em>.
889
890<h3 class=fn>const&nbsp;<a href="qcstring.html">QCString</a> <a name="operator+-4"></a>operator+ ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s, char&nbsp;c )
891</h3>
892This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
893<p>
894<p> Returns a string which consists of the concatenation of <em>s</em> and <em>c</em>.
895
896<h3 class=fn>const&nbsp;<a href="qcstring.html">QCString</a> <a name="operator+-5"></a>operator+ ( char&nbsp;c, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s )
897</h3>
898This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
899<p>
900<p> Returns a string which consists of the concatenation of <em>c</em> and <em>s</em>.
901
902<h3 class=fn>bool <a name="operator-lt"></a>operator&lt; ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
903</h3>
904
905<p>
906<p> Returns TRUE if <em>s1</em> is less than <em>s2</em>; otherwise returns FALSE.
907<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &lt; 0.
908<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
909
910<h3 class=fn>bool <a name="operator-lt-2"></a>operator&lt; ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
911</h3>
912This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
913<p>
914<p> Returns TRUE if <em>s1</em> is less than <em>s2</em>; otherwise returns FALSE.
915<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &lt; 0.
916<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
917
918<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;str )
919</h3>
920
921<p> Writes string <em>str</em> to the stream <em>s</em>.
922<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
923
924<h3 class=fn>bool <a name="operator-lt-eq"></a>operator&lt;= ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
925</h3>
926
927<p>
928<p> Returns TRUE if <em>s1</em> is less than or equal to <em>s2</em>; otherwise
929returns FALSE.
930<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &lt;= 0.
931<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
932
933<h3 class=fn>bool <a name="operator-lt-eq-2"></a>operator&lt;= ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
934</h3>
935This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
936<p>
937<p> Returns TRUE if <em>s1</em> is less than or equal to <em>s2</em>; otherwise
938returns FALSE.
939<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &lt;= 0.
940<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
941
942<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
943</h3>
944
945<p>
946<p> Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
947<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) == 0.
948
949<h3 class=fn>bool <a name="operator-eq-eq-2"></a>operator== ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
950</h3>
951This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
952<p>
953<p> Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
954<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) == 0.
955
956<h3 class=fn>bool <a name="operator-eq-eq-3"></a>operator== ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
957</h3>
958This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
959<p>
960<p> Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
961<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) == 0.
962
963<h3 class=fn>bool <a name="operator-gt"></a>operator&gt; ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
964</h3>
965
966<p>
967<p> Returns TRUE if <em>s1</em> is greater than <em>s2</em>; otherwise returns FALSE.
968<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &gt; 0.
969<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
970
971<h3 class=fn>bool <a name="operator-gt-2"></a>operator&gt; ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
972</h3>
973This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
974<p>
975<p> Returns TRUE if <em>s1</em> is greater than <em>s2</em>; otherwise returns FALSE.
976<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &gt; 0.
977<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
978
979<h3 class=fn>bool <a name="operator-gt-eq"></a>operator&gt;= ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s1, const&nbsp;char&nbsp;*&nbsp;s2 )
980</h3>
981
982<p>
983<p> Returns TRUE if <em>s1</em> is greater than or equal to <em>s2</em>; otherwise
984returns FALSE.
985<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &gt;= 0.
986<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
987
988<h3 class=fn>bool <a name="operator-gt-eq-2"></a>operator&gt;= ( const&nbsp;char&nbsp;*&nbsp;s1, const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;s2 )
989</h3>
990This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
991<p>
992<p> Returns TRUE if <em>s1</em> is greater than or equal to <em>s2</em>; otherwise
993returns FALSE.
994<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) &gt;= 0.
995<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
996
997<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;str )
998</h3>
999
1000<p> Reads a string into <em>str</em> from the stream <em>s</em>.
1001<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
1002
1003<h3 class=fn>void * <a name="qmemmove"></a>qmemmove ( void&nbsp;*&nbsp;dst, const&nbsp;void&nbsp;*&nbsp;src, uint&nbsp;len )
1004</h3>
1005
1006<p> This function is normally part of the C library. Qt implements
1007memmove() for platforms that do not provide it.
1008<p> memmove() copies <em>len</em> bytes from <em>src</em> into <em>dst</em>. The data
1009is copied correctly even if <em>src</em> and <em>dst</em> overlap.
1010
1011<h3 class=fn>int <a name="qstrcmp"></a>qstrcmp ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2 )
1012</h3>
1013
1014<p>
1015<p> A safe strcmp() function.
1016<p> Compares <em>str1</em> and <em>str2</em>. Returns a negative value if <em>str1</em>
1017is less than <em>str2</em>, 0 if <em>str1</em> is equal to <em>str2</em> or a
1018positive value if <em>str1</em> is greater than <em>str2</em>.
1019<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
1020<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
1021or <em>str2</em> is 0 (but not both).
1022<p> <p>See also <a href="#qstrncmp">qstrncmp</a>(), <a href="#qstricmp">qstricmp</a>(), <a href="#qstrnicmp">qstrnicmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
1023
1024<h3 class=fn>char * <a name="qstrcpy"></a>qstrcpy ( char&nbsp;*&nbsp;dst, const&nbsp;char&nbsp;*&nbsp;src )
1025</h3>
1026
1027<p>
1028<p> A safe strcpy() function.
1029<p> Copies all characters up to and including the '&#92;0' from <em>src</em>
1030into <em>dst</em> and returns a pointer to <em>dst</em>.
1031
1032<h3 class=fn>char * <a name="qstrdup"></a>qstrdup ( const&nbsp;char&nbsp;*&nbsp;src )
1033</h3>
1034
1035<p> Returns a duplicate string.
1036<p> Allocates space for a copy of <em>src</em>, copies it, and returns a
1037pointer to the copy. If <em>src</em> is 0, it immediately returns 0.
1038<p> The returned string must be deleted using <tt>delete[]</tt>.
1039
1040<h3 class=fn>int <a name="qstricmp"></a>qstricmp ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2 )
1041</h3>
1042
1043<p> A safe stricmp() function.
1044<p> Compares <em>str1</em> and <em>str2</em> ignoring the case.
1045<p> Returns a negative value if <em>str1</em> is less than <em>str2</em>, 0 if <em>str1</em> is equal to <em>str2</em> or a positive value if <em>str1</em> is greater
1046than <em>str2</em>.
1047<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
1048<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
1049or <em>str2</em> is 0 (but not both).
1050<p> <p>See also <a href="#qstrcmp">qstrcmp</a>(), <a href="#qstrncmp">qstrncmp</a>(), <a href="#qstrnicmp">qstrnicmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
1051
1052<h3 class=fn>uint <a name="qstrlen"></a>qstrlen ( const&nbsp;char&nbsp;*&nbsp;str )
1053</h3>
1054
1055<p>
1056<p> A safe strlen function.
1057<p> Returns the number of characters that precede the terminating '&#92;0'.
1058or 0 if <em>str</em> is 0.
1059
1060<h3 class=fn>int <a name="qstrncmp"></a>qstrncmp ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2, uint&nbsp;len )
1061</h3>
1062
1063<p>
1064<p> A safe strncmp() function.
1065<p> Compares at most <em>len</em> bytes of <em>str1</em> and <em>str2</em>.
1066<p> Returns a negative value if <em>str1</em> is less than <em>str2</em>, 0 if <em>str1</em> is equal to <em>str2</em> or a positive value if <em>str1</em> is greater
1067than <em>str2</em>.
1068<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
1069<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
1070or <em>str2</em> is 0 (but not both).
1071<p> <p>See also <a href="#qstrcmp">qstrcmp</a>(), <a href="#qstricmp">qstricmp</a>(), <a href="#qstrnicmp">qstrnicmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
1072
1073<h3 class=fn>char * <a name="qstrncpy"></a>qstrncpy ( char&nbsp;*&nbsp;dst, const&nbsp;char&nbsp;*&nbsp;src, uint&nbsp;len )
1074</h3>
1075
1076<p> A safe strncpy() function.
1077<p> Copies at most <em>len</em> bytes from <em>src</em> (stopping at <em>len</em> or the
1078terminating '&#92;0' whichever comes first) into <em>dst</em> and returns a
1079pointer to <em>dst</em>. Guarantees that <em>dst</em> is '&#92;0'-terminated. If
1080<em>src</em> or <em>dst</em> is 0, returns 0 immediately.
1081<p> <p>See also <a href="#qstrcpy">qstrcpy</a>().
1082
1083<h3 class=fn>int <a name="qstrnicmp"></a>qstrnicmp ( const&nbsp;char&nbsp;*&nbsp;str1, const&nbsp;char&nbsp;*&nbsp;str2, uint&nbsp;len )
1084</h3>
1085
1086<p> A safe strnicmp() function.
1087<p> Compares at most <em>len</em> bytes of <em>str1</em> and <em>str2</em> ignoring the case.
1088<p> Returns a negative value if <em>str1</em> is less than <em>str2</em>, 0 if <em>str1</em>
1089is equal to <em>str2</em> or a positive value if <em>str1</em> is greater than <em>str2</em>.
1090<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
1091<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
1092or <em>str2</em> is 0 (but not both).
1093<p> <p>See also <a href="#qstrcmp">qstrcmp</a>(), <a href="#qstrncmp">qstrncmp</a>(), <a href="#qstricmp">qstricmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
1094
1095<!-- eof -->
1096<hr><p>
1097This file is part of the <a href="index.html">Qt toolkit</a>.
1098Copyright &copy; 1995-2007
1099<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
1100<table width=100% cellspacing=0 border=0><tr>
1101<td>Copyright &copy; 2007
1102<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
1103<td align=right><div align=right>Qt 3.3.8</div>
1104</table></div></address></body>
1105</html>
Note: See TracBrowser for help on using the repository browser.