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"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { 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 Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main 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 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
|
---|
35 | zero-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 <<a href="qcstring-h.html">qcstring.h</a>></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 size )</li>
|
---|
45 | <li class=fn><a href="#QCString-3"><b>QCString</b></a> ( const QCString & s )</li>
|
---|
46 | <li class=fn><a href="#QCString-4"><b>QCString</b></a> ( const char * str )</li>
|
---|
47 | <li class=fn><a href="#QCString-5"><b>QCString</b></a> ( const char * str, uint maxsize )</li>
|
---|
48 | <li class=fn>QCString & <a href="#operator-eq"><b>operator=</b></a> ( const QCString & s )</li>
|
---|
49 | <li class=fn>QCString & <a href="#operator-eq-2"><b>operator=</b></a> ( const char * 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 len )</li>
|
---|
54 | <li class=fn>bool <a href="#truncate"><b>truncate</b></a> ( uint pos )</li>
|
---|
55 | <li class=fn>bool <a href="#fill"><b>fill</b></a> ( char c, int len = -1 )</li>
|
---|
56 | <li class=fn>QCString <a href="#copy"><b>copy</b></a> () const</li>
|
---|
57 | <li class=fn>QCString & <a href="#sprintf"><b>sprintf</b></a> ( const char * format, ... )</li>
|
---|
58 | <li class=fn>int <a href="#find"><b>find</b></a> ( char c, int index = 0, bool cs = TRUE ) const</li>
|
---|
59 | <li class=fn>int <a href="#find-2"><b>find</b></a> ( const char * str, int index = 0, bool cs = TRUE ) const</li>
|
---|
60 | <li class=fn>int <a href="#find-3"><b>find</b></a> ( const QRegExp & rx, int index = 0 ) const</li>
|
---|
61 | <li class=fn>int <a href="#findRev"><b>findRev</b></a> ( char c, int index = -1, bool cs = TRUE ) const</li>
|
---|
62 | <li class=fn>int <a href="#findRev-2"><b>findRev</b></a> ( const char * str, int index = -1, bool cs = TRUE ) const</li>
|
---|
63 | <li class=fn>int <a href="#findRev-3"><b>findRev</b></a> ( const QRegExp & rx, int index = -1 ) const</li>
|
---|
64 | <li class=fn>int <a href="#contains"><b>contains</b></a> ( char c, bool cs = TRUE ) const</li>
|
---|
65 | <li class=fn>int <a href="#contains-2"><b>contains</b></a> ( const char * str, bool cs = TRUE ) const</li>
|
---|
66 | <li class=fn>int <a href="#contains-3"><b>contains</b></a> ( const QRegExp & rx ) const</li>
|
---|
67 | <li class=fn>QCString <a href="#left"><b>left</b></a> ( uint len ) const</li>
|
---|
68 | <li class=fn>QCString <a href="#right"><b>right</b></a> ( uint len ) const</li>
|
---|
69 | <li class=fn>QCString <a href="#mid"><b>mid</b></a> ( uint index, uint len = 0xffffffff ) const</li>
|
---|
70 | <li class=fn>QCString <a href="#leftJustify"><b>leftJustify</b></a> ( uint width, char fill = ' ', bool truncate = FALSE ) const</li>
|
---|
71 | <li class=fn>QCString <a href="#rightJustify"><b>rightJustify</b></a> ( uint width, char fill = ' ', bool 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 & <a href="#insert-2"><b>insert</b></a> ( uint index, const char * s )</li>
|
---|
77 | <li class=fn>QCString & <a href="#insert"><b>insert</b></a> ( uint index, char c )</li>
|
---|
78 | <li class=fn>QCString & <a href="#append"><b>append</b></a> ( const char * str )</li>
|
---|
79 | <li class=fn>QCString & <a href="#prepend"><b>prepend</b></a> ( const char * s )</li>
|
---|
80 | <li class=fn>QCString & <a href="#remove"><b>remove</b></a> ( uint index, uint len )</li>
|
---|
81 | <li class=fn>QCString & <a href="#replace"><b>replace</b></a> ( uint index, uint len, const char * str )</li>
|
---|
82 | <li class=fn>QCString & <a href="#replace-2"><b>replace</b></a> ( const QRegExp & rx, const char * str )</li>
|
---|
83 | <li class=fn>QCString & <a href="#replace-3"><b>replace</b></a> ( char c, const char * after )</li>
|
---|
84 | <li class=fn>QCString & <a href="#replace-4"><b>replace</b></a> ( const char * before, const char * after )</li>
|
---|
85 | <li class=fn>QCString & <a href="#replace-5"><b>replace</b></a> ( char c1, char c2 )</li>
|
---|
86 | <li class=fn>short <a href="#toShort"><b>toShort</b></a> ( bool * ok = 0 ) const</li>
|
---|
87 | <li class=fn>ushort <a href="#toUShort"><b>toUShort</b></a> ( bool * ok = 0 ) const</li>
|
---|
88 | <li class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool * ok = 0 ) const</li>
|
---|
89 | <li class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool * ok = 0 ) const</li>
|
---|
90 | <li class=fn>long <a href="#toLong"><b>toLong</b></a> ( bool * ok = 0 ) const</li>
|
---|
91 | <li class=fn>ulong <a href="#toULong"><b>toULong</b></a> ( bool * ok = 0 ) const</li>
|
---|
92 | <li class=fn>float <a href="#toFloat"><b>toFloat</b></a> ( bool * ok = 0 ) const</li>
|
---|
93 | <li class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool * ok = 0 ) const</li>
|
---|
94 | <li class=fn>QCString & <a href="#setStr"><b>setStr</b></a> ( const char * str )</li>
|
---|
95 | <li class=fn>QCString & <a href="#setNum-2"><b>setNum</b></a> ( short n )</li>
|
---|
96 | <li class=fn>QCString & <a href="#setNum-3"><b>setNum</b></a> ( ushort n )</li>
|
---|
97 | <li class=fn>QCString & <a href="#setNum-4"><b>setNum</b></a> ( int n )</li>
|
---|
98 | <li class=fn>QCString & <a href="#setNum-5"><b>setNum</b></a> ( uint n )</li>
|
---|
99 | <li class=fn>QCString & <a href="#setNum-6"><b>setNum</b></a> ( long n )</li>
|
---|
100 | <li class=fn>QCString & <a href="#setNum-7"><b>setNum</b></a> ( ulong n )</li>
|
---|
101 | <li class=fn>QCString & <a href="#setNum-8"><b>setNum</b></a> ( float n, char f = 'g', int prec = 6 )</li>
|
---|
102 | <li class=fn>QCString & <a href="#setNum"><b>setNum</b></a> ( double n, char f = 'g', int prec = 6 )</li>
|
---|
103 | <li class=fn>bool <a href="#setExpand"><b>setExpand</b></a> ( uint index, char c )</li>
|
---|
104 | <li class=fn><a href="#operator-const-char-*"><b>operator const char *</b></a> () const</li>
|
---|
105 | <li class=fn>QCString & <a href="#operator+-eq"><b>operator+=</b></a> ( const char * str )</li>
|
---|
106 | <li class=fn>QCString & <a href="#operator+-eq-2"><b>operator+=</b></a> ( char c )</li>
|
---|
107 | </ul>
|
---|
108 | <h2>Related Functions</h2>
|
---|
109 | <ul>
|
---|
110 | <li class=fn>void * <a href="#qmemmove"><b>qmemmove</b></a> ( void * dst, const void * src, uint len )</li>
|
---|
111 | <li class=fn>char * <a href="#qstrdup"><b>qstrdup</b></a> ( const char * src )</li>
|
---|
112 | <li class=fn>char * <a href="#qstrcpy"><b>qstrcpy</b></a> ( char * dst, const char * src )</li>
|
---|
113 | <li class=fn>char * <a href="#qstrncpy"><b>qstrncpy</b></a> ( char * dst, const char * src, uint len )</li>
|
---|
114 | <li class=fn>uint <a href="#qstrlen"><b>qstrlen</b></a> ( const char * str )</li>
|
---|
115 | <li class=fn>int <a href="#qstrcmp"><b>qstrcmp</b></a> ( const char * str1, const char * str2 )</li>
|
---|
116 | <li class=fn>int <a href="#qstrncmp"><b>qstrncmp</b></a> ( const char * str1, const char * str2, uint len )</li>
|
---|
117 | <li class=fn>int <a href="#qstricmp"><b>qstricmp</b></a> ( const char * str1, const char * str2 )</li>
|
---|
118 | <li class=fn>int <a href="#qstrnicmp"><b>qstrnicmp</b></a> ( const char * str1, const char * str2, uint len )</li>
|
---|
119 | <li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QCString & str )</li>
|
---|
120 | <li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QCString & str )</li>
|
---|
121 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QCString & s1, const QCString & s2 )</li>
|
---|
122 | <li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
123 | <li class=fn>bool <a href="#operator-eq-eq-3"><b>operator==</b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
124 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QCString & s1, const QCString & s2 )</li>
|
---|
125 | <li class=fn>bool <a href="#operator!-eq-2"><b>operator!=</b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
126 | <li class=fn>bool <a href="#operator!-eq-3"><b>operator!=</b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
127 | <li class=fn>bool <a href="#operator-lt"><b>operator<</b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
128 | <li class=fn>bool <a href="#operator-lt-2"><b>operator<</b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
129 | <li class=fn>bool <a href="#operator-lt-eq"><b>operator<=</b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
130 | <li class=fn>bool <a href="#operator-lt-eq-2"><b>operator<=</b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
131 | <li class=fn>bool <a href="#operator-gt"><b>operator></b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
132 | <li class=fn>bool <a href="#operator-gt-2"><b>operator></b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
133 | <li class=fn>bool <a href="#operator-gt-eq"><b>operator>=</b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
134 | <li class=fn>bool <a href="#operator-gt-eq-2"><b>operator>=</b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
135 | <li class=fn>const QCString <a href="#operator+"><b>operator+</b></a> ( const QCString & s1, const QCString & s2 )</li>
|
---|
136 | <li class=fn>const QCString <a href="#operator+-2"><b>operator+</b></a> ( const QCString & s1, const char * s2 )</li>
|
---|
137 | <li class=fn>const QCString <a href="#operator+-3"><b>operator+</b></a> ( const char * s1, const QCString & s2 )</li>
|
---|
138 | <li class=fn>const QCString <a href="#operator+-4"><b>operator+</b></a> ( const QCString & s, char c )</li>
|
---|
139 | <li class=fn>const QCString <a href="#operator+-5"><b>operator+</b></a> ( char c, const QCString & s )</li>
|
---|
140 | </ul>
|
---|
141 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 | The QCString class provides an abstraction of the classic C
|
---|
146 | zero-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><char>. 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>.
|
---|
154 | The price of doing this is that some algorithms will perform
|
---|
155 | badly. For example, <a href="#append">append</a>() is O(length()) since it scans for a
|
---|
156 | null terminator. Although you might use QCString for text that is
|
---|
157 | never exposed to the user, for most purposes, and especially for
|
---|
158 | user-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,
|
---|
160 | and is well optimized.
|
---|
161 | <p> Note that for the QCString methods that take a <tt>const char *</tt>
|
---|
162 | parameter the <tt>const char *</tt> must either be 0 (null) or not-null
|
---|
163 | and '\0' (NUL byte) terminated; otherwise the results are
|
---|
164 | undefined.
|
---|
165 | <p> A QCString that has not been assigned to anything is <em>null</em>, i.e.
|
---|
166 | both the length and the data pointer is 0. A QCString that
|
---|
167 | references the empty string ("", a single '\0' char) is <em>empty</em>.
|
---|
168 | Both null and empty QCStrings are legal parameters to the methods.
|
---|
169 | Assigning <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>()
|
---|
171 | resizes the string and <a href="#truncate">truncate</a>() truncates the string. A string
|
---|
172 | can be filled with a character using <a href="#fill">fill</a>(). Strings can be left
|
---|
173 | or right padded with characters using <a href="#leftJustify">leftJustify</a>() and
|
---|
174 | <a href="#rightJustify">rightJustify</a>(). Characters, strings and regular expressions can be
|
---|
175 | searched 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
|
---|
178 | with <a href="#append">append</a>(). A string can be prepended with <a href="#prepend">prepend</a>().
|
---|
179 | Characters can be removed from the string with <a href="#remove">remove</a>() and
|
---|
180 | replaced 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
|
---|
184 | lowercase 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>().
|
---|
187 | Numbers can be converted to strings with <a href="#setNum">setNum</a>().
|
---|
188 | <p> Many operators are overloaded to work with QCStrings. QCString
|
---|
189 | also 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
|
---|
195 | character is greater than or less than another character is locale
|
---|
196 | dependent. This affects functions which support a case insensitive
|
---|
197 | option or which compare or lowercase or uppercase their arguments.
|
---|
198 | Case insensitive operations and comparisons will be accurate if
|
---|
199 | both strings contain only ASCII characters. (If <tt>$LC_CTYPE</tt> is
|
---|
200 | set, most Unix systems do "the right thing".) Functions that this
|
---|
201 | affects include <a href="#contains">contains</a>(), <a href="#find">find</a>(), <a href="#findRev">findRev</a>(), <a href="#operator-lt">operator<</a>(), <a href="#operator-lt-eq">operator<=</a>(), <a href="#operator-gt">operator></a>(), <a href="#operator-gt-eq">operator>=</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
|
---|
204 | characters using Unicode.
|
---|
205 | </blockquote>
|
---|
206 | <p>
|
---|
207 | <p> Performance note: The QCString methods for <a href="qregexp.html">QRegExp</a> searching are
|
---|
208 | implemented by converting the QCString to a <a href="qstring.html">QString</a> and performing
|
---|
209 | the search on that. This implies a <a href="shclass.html#deep-copy">deep copy</a> of the QCString data.
|
---|
210 | If you are going to perform many QRegExp searches on a large
|
---|
211 | QCString, you will get better performance by converting the
|
---|
212 | QCString 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 size )
|
---|
223 | </h3>
|
---|
224 | Constructs a string with room for <em>size</em> characters, including
|
---|
225 | the '\0'-terminator. Makes a null string if <em>size</em> == 0.
|
---|
226 | <p> If <em>size</em> > 0, then the first and last characters in the string
|
---|
227 | are initialized to '\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 <a href="qcstring.html">QCString</a> & 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 char * str )
|
---|
237 | </h3>
|
---|
238 | Constructs 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 char * str, uint maxsize )
|
---|
243 | </h3>
|
---|
244 | Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>. The copy will
|
---|
245 | be at most <em>maxsize</em> bytes long including the '\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
|
---|
252 | resulting QCString will be terminated by this 0. If <em>str</em> is 0 a
|
---|
253 | null string is created.
|
---|
254 | <p> <p>See also <a href="#isNull">isNull</a>().
|
---|
255 |
|
---|
256 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="append"></a>QCString::append ( const char * str )
|
---|
257 | </h3>
|
---|
258 |
|
---|
259 | <p> Appends string <em>str</em> to the string and returns a reference to the
|
---|
260 | string. Equivalent to <a href="#operator+-eq">operator+=</a>().
|
---|
261 |
|
---|
262 | <h3 class=fn>int <a name="contains"></a>QCString::contains ( char c, bool cs = TRUE ) const
|
---|
263 | </h3>
|
---|
264 | Returns the number of times the character <em>c</em> occurs in the
|
---|
265 | string.
|
---|
266 | <p> The match is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
---|
267 | if <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 char * str, bool cs = TRUE ) const
|
---|
271 | </h3>
|
---|
272 | This 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
|
---|
275 | if <em>cs</em> if FALSE.
|
---|
276 | <p> This function counts overlapping substrings, for example, "banana"
|
---|
277 | contains 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 <a href="qregexp.html">QRegExp</a> & rx ) const
|
---|
281 | </h3>
|
---|
282 | This 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
|
---|
294 | string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
|
---|
295 | apply 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 c, int len = -1 )
|
---|
304 | </h3>
|
---|
305 | Fills the string with <em>len</em> bytes of character <em>c</em>, followed by
|
---|
306 | a '\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
|
---|
309 | memory to resize the string; otherwise returns TRUE.
|
---|
310 |
|
---|
311 | <h3 class=fn>int <a name="find"></a>QCString::find ( char c, int index = 0, bool cs = TRUE ) const
|
---|
312 | </h3>
|
---|
313 | Finds the first occurrence of the character <em>c</em>, starting at
|
---|
314 | position <em>index</em>.
|
---|
315 | <p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
---|
316 | if <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 char * str, int index = 0, bool cs = TRUE ) const
|
---|
322 | </h3>
|
---|
323 | This 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
|
---|
325 | position <em>index</em>.
|
---|
326 | <p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
---|
327 | if <em>cs</em> is FALSE.
|
---|
328 | <p> Returns the position of <em>str</em>, or -1 if <em>str</em> could not be
|
---|
329 | found.
|
---|
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 <a href="qregexp.html">QRegExp</a> & rx, int index = 0 ) const
|
---|
333 | </h3>
|
---|
334 | This 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>,
|
---|
336 | starting at position <em>index</em>.
|
---|
337 | <p> Returns the position of the next match, or -1 if <em>rx</em> was not
|
---|
338 | found.
|
---|
339 | <p> <b>Warning:</b> If you want to apply this function repeatedly to the same
|
---|
340 | string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
|
---|
341 | apply the function to that.
|
---|
342 |
|
---|
343 | <h3 class=fn>int <a name="findRev"></a>QCString::findRev ( char c, int index = -1, bool cs = TRUE ) const
|
---|
344 | </h3>
|
---|
345 | Finds the first occurrence of the character <em>c</em>, starting at
|
---|
346 | position <em>index</em> and searching backwards.
|
---|
347 | <p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
---|
348 | if <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 char * str, int index = -1, bool cs = TRUE ) const
|
---|
353 | </h3>
|
---|
354 | This 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
|
---|
356 | position <em>index</em> and searching backwards.
|
---|
357 | <p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
---|
358 | if <em>cs</em> is FALSE.
|
---|
359 | <p> Returns the position of <em>str</em>, or -1 if <em>str</em> could not be
|
---|
360 | found.
|
---|
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 <a href="qregexp.html">QRegExp</a> & rx, int index = -1 ) const
|
---|
364 | </h3>
|
---|
365 | This 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>,
|
---|
367 | starting at position <em>index</em> and searching backwards.
|
---|
368 | <p> Returns the position of the next match (backwards), or -1 if <em>rx</em>
|
---|
369 | was not found.
|
---|
370 | <p> <b>Warning:</b> If you want to apply this function repeatedly to the same
|
---|
371 | string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
|
---|
372 | apply the function to that.
|
---|
373 |
|
---|
374 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="insert"></a>QCString::insert ( uint index, char c )
|
---|
375 | </h3>
|
---|
376 | Inserts character <em>c</em> into the string at position <em>index</em> and
|
---|
377 | returns a reference to the string.
|
---|
378 | <p> If <em>index</em> is beyond the end of the string, the string is
|
---|
379 | padded with spaces (ASCII 32) to length <em>index</em> and then <em>c</em>
|
---|
380 | is 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> & <a name="insert-2"></a>QCString::insert ( uint index, const char * s )
|
---|
390 | </h3>
|
---|
391 | This 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
|
---|
394 | padded with spaces (ASCII 32) to length <em>index</em> and then <em>s</em>
|
---|
395 | is 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;
|
---|
409 | otherwise returns FALSE. An empty string is not always a null
|
---|
410 | string.
|
---|
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
|
---|
418 | returns 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 len ) const
|
---|
432 | </h3>
|
---|
433 | Returns a substring that contains the <em>len</em> leftmost characters
|
---|
434 | of the string.
|
---|
435 | <p> The whole string is returned if <em>len</em> exceeds the length of the
|
---|
436 | string.
|
---|
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 width, char fill = ' ', bool truncate = FALSE ) const
|
---|
447 | </h3>
|
---|
448 | Returns a string of length <em>width</em> (plus one for the terminating
|
---|
449 | '\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
|
---|
451 | FALSE (the default), then the returned string is a copy of the
|
---|
452 | string. 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 '\0'-terminator.
|
---|
465 | Equivalent 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>
|
---|
472 | Returns a new string that is a copy of this string converted to lower
|
---|
473 | case.
|
---|
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 index, uint len = 0xffffffff ) const
|
---|
483 | </h3>
|
---|
484 | Returns a substring that contains at most <em>len</em> characters from
|
---|
485 | this 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
|
---|
487 | of range. Returns the whole string from <em>index</em> if <em>index+len</em>
|
---|
488 | exceeds 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> & <a name="operator+-eq"></a>QCString::operator+= ( const char * str )
|
---|
504 | </h3>
|
---|
505 | Appends 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> & <a name="operator+-eq-2"></a>QCString::operator+= ( char c )
|
---|
508 | </h3>
|
---|
509 | This 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> & <a name="operator-eq"></a>QCString::operator= ( const <a href="qcstring.html">QCString</a> & 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
|
---|
516 | reference to this string.
|
---|
517 |
|
---|
518 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="operator-eq-2"></a>QCString::operator= ( const char * str )
|
---|
519 | </h3>
|
---|
520 | This 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
|
---|
522 | reference 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> & <a name="prepend"></a>QCString::prepend ( const char * 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> & <a name="remove"></a>QCString::remove ( uint index, uint len )
|
---|
533 | </h3>
|
---|
534 | Removes <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
|
---|
536 | valid, but <em>index</em> + <em>len</em> is larger than the length of the
|
---|
537 | string, 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> & <a name="replace"></a>QCString::replace ( uint index, uint len, const char * str )
|
---|
547 | </h3>
|
---|
548 | Replaces <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
|
---|
551 | appended 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>
|
---|
552 | replaces 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> & <a name="replace-2"></a>QCString::replace ( const <a href="qregexp.html">QRegExp</a> & rx, const char * str )
|
---|
561 | </h3>
|
---|
562 | This 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>.
|
---|
564 | Returns 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
|
---|
578 | string it is more efficient to convert the string to a <a href="qstring.html">QString</a> and
|
---|
579 | apply the function to that.
|
---|
580 |
|
---|
581 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="replace-3"></a>QCString::replace ( char c, const char * 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
|
---|
584 | with <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> & <a name="replace-4"></a>QCString::replace ( const char * before, const char * 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
|
---|
596 | with 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> & <a name="replace-5"></a>QCString::replace ( char c1, char 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>.
|
---|
608 | Returns a reference to the string.
|
---|
609 |
|
---|
610 | <h3 class=fn>bool <a name="resize"></a>QCString::resize ( uint len )
|
---|
611 | </h3>
|
---|
612 | Extends or shrinks the string to <em>len</em> bytes, including the
|
---|
613 | '\0'-terminator.
|
---|
614 | <p> A '\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 len ) const
|
---|
626 | </h3>
|
---|
627 | Returns a substring that contains the <em>len</em> rightmost characters
|
---|
628 | of the string.
|
---|
629 | <p> The whole string is returned if <em>len</em> exceeds the length of the
|
---|
630 | string.
|
---|
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 width, char fill = ' ', bool truncate = FALSE ) const
|
---|
641 | </h3>
|
---|
642 | Returns a string of length <em>width</em> (plus one for the terminating
|
---|
643 | '\0') that contains zero or more of the <em>fill</em> character followed
|
---|
644 | by this string.
|
---|
645 | <p> If the length of the string exceeds <em>width</em> and <em>truncate</em> is
|
---|
646 | FALSE (the default), then the returned string is a copy of the
|
---|
647 | string. 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 index, char c )
|
---|
657 | </h3>
|
---|
658 | Sets the character at position <em>index</em> to <em>c</em> and expands the
|
---|
659 | string if necessary, padding with spaces.
|
---|
660 | <p> Returns FALSE if <em>index</em> was out of range and the string could
|
---|
661 | not be expanded; otherwise returns TRUE.
|
---|
662 |
|
---|
663 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum"></a>QCString::setNum ( double n, char f = 'g', int prec = 6 )
|
---|
664 | </h3>
|
---|
665 | Sets the string to the string representation of the number <em>n</em>
|
---|
666 | and returns a reference to the string.
|
---|
667 | <p> The format of the string representation is specified by the format
|
---|
668 | character <em>f</em>, and the precision (number of digits after the
|
---|
669 | decimal point) is specified with <em>prec</em>.
|
---|
670 | <p> The valid formats for <em>f</em> are 'e', 'E', 'f', 'g' and 'G'. The
|
---|
671 | formats 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> & <a name="setNum-2"></a>QCString::setNum ( short n )
|
---|
674 | </h3>
|
---|
675 | This 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>
|
---|
677 | and returns a reference to the string.
|
---|
678 |
|
---|
679 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum-3"></a>QCString::setNum ( ushort n )
|
---|
680 | </h3>
|
---|
681 | This 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>
|
---|
683 | and returns a reference to the string.
|
---|
684 |
|
---|
685 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum-4"></a>QCString::setNum ( int n )
|
---|
686 | </h3>
|
---|
687 | This 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>
|
---|
689 | and returns a reference to the string.
|
---|
690 |
|
---|
691 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum-5"></a>QCString::setNum ( uint n )
|
---|
692 | </h3>
|
---|
693 | This 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>
|
---|
695 | and returns a reference to the string.
|
---|
696 |
|
---|
697 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum-6"></a>QCString::setNum ( long n )
|
---|
698 | </h3>
|
---|
699 | This 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>
|
---|
701 | and returns a reference to the string.
|
---|
702 |
|
---|
703 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum-7"></a>QCString::setNum ( ulong n )
|
---|
704 | </h3>
|
---|
705 | This 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>
|
---|
707 | and returns a reference to the string.
|
---|
708 |
|
---|
709 | <h3 class=fn><a href="qcstring.html">QCString</a> & <a name="setNum-8"></a>QCString::setNum ( float n, char f = 'g', int 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> & <a name="setStr"></a>QCString::setStr ( const char * str )
|
---|
713 | </h3>
|
---|
714 | Makes 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>
|
---|
718 | Returns a new string that has white space removed from the start
|
---|
719 | and the end, plus any sequence of internal white space replaced
|
---|
720 | with a single space (ASCII 32).
|
---|
721 | <p> White space means the decimal ASCII codes 9, 10, 11, 12, 13 and
|
---|
722 | 32.
|
---|
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> & <a name="sprintf"></a>QCString::sprintf ( const char * format, ... )
|
---|
731 | </h3>
|
---|
732 | Implemented as a call to the native vsprintf() (see the manual for
|
---|
733 | your 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
|
---|
736 | string is resized back to its actual length before sprintf()
|
---|
737 | returns.
|
---|
738 | <p> Example:
|
---|
739 | <pre>
|
---|
740 | QCString s;
|
---|
741 | s.<a href="#sprintf">sprintf</a>( "%d - %s", 1, "first" ); // result < 256 chars
|
---|
742 |
|
---|
743 | QCString big( 25000 ); // very long string
|
---|
744 | big.<a href="#sprintf">sprintf</a>( "%d - %s", 2, longString ); // result < 25000 chars
|
---|
745 | </pre>
|
---|
746 |
|
---|
747 | <p> <b>Warning:</b> All vsprintf() implementations will write past the end of
|
---|
748 | the target string (*this) if the <em>format</em> specification and
|
---|
749 | arguments happen to be longer than the target string, and some
|
---|
750 | will also fail if the target string is longer than some arbitrary
|
---|
751 | implementation limit.
|
---|
752 | <p> Giving user-supplied arguments to sprintf() is risky: Sooner or
|
---|
753 | later 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>
|
---|
757 | Returns a new string that has white space removed from the start
|
---|
758 | and the end.
|
---|
759 | <p> White space means the decimal ASCII codes 9, 10, 11, 12, 13 and
|
---|
760 | 32.
|
---|
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 * ok = 0 ) const
|
---|
770 | </h3>
|
---|
771 | Returns 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
|
---|
773 | number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
---|
774 | TRUE.
|
---|
775 |
|
---|
776 | <h3 class=fn>float <a name="toFloat"></a>QCString::toFloat ( bool * ok = 0 ) const
|
---|
777 | </h3>
|
---|
778 | Returns 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
|
---|
780 | number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
---|
781 | TRUE.
|
---|
782 |
|
---|
783 | <h3 class=fn>int <a name="toInt"></a>QCString::toInt ( bool * ok = 0 ) const
|
---|
784 | </h3>
|
---|
785 | Returns 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
|
---|
787 | number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
---|
788 | TRUE.
|
---|
789 |
|
---|
790 | <h3 class=fn>long <a name="toLong"></a>QCString::toLong ( bool * ok = 0 ) const
|
---|
791 | </h3>
|
---|
792 | Returns 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
|
---|
794 | number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
---|
795 | TRUE.
|
---|
796 |
|
---|
797 | <h3 class=fn>short <a name="toShort"></a>QCString::toShort ( bool * ok = 0 ) const
|
---|
798 | </h3>
|
---|
799 | Returns 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
|
---|
801 | number, 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 * ok = 0 ) const
|
---|
805 | </h3>
|
---|
806 | Returns 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
|
---|
808 | number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
---|
809 | TRUE.
|
---|
810 |
|
---|
811 | <h3 class=fn>ulong <a name="toULong"></a>QCString::toULong ( bool * ok = 0 ) const
|
---|
812 | </h3>
|
---|
813 | Returns 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
|
---|
815 | number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
---|
816 | TRUE.
|
---|
817 |
|
---|
818 | <h3 class=fn>ushort <a name="toUShort"></a>QCString::toUShort ( bool * ok = 0 ) const
|
---|
819 | </h3>
|
---|
820 | Returns 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
|
---|
822 | number, 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 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>
|
---|
840 | Returns 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 <a href="qcstring.html">QCString</a> & s1, const <a href="qcstring.html">QCString</a> & 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 <a href="qcstring.html">QCString</a> & s1, const char * s2 )
|
---|
858 | </h3>
|
---|
859 | This 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 char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
865 | </h3>
|
---|
866 | This 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 <a href="qcstring.html">QCString</a> <a name="operator+"></a>operator+ ( const <a href="qcstring.html">QCString</a> & s1, const <a href="qcstring.html">QCString</a> & 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 <a href="qcstring.html">QCString</a> <a name="operator+-2"></a>operator+ ( const <a href="qcstring.html">QCString</a> & s1, const char * s2 )
|
---|
879 | </h3>
|
---|
880 | This 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 <a href="qcstring.html">QCString</a> <a name="operator+-3"></a>operator+ ( const char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
885 | </h3>
|
---|
886 | This 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 <a href="qcstring.html">QCString</a> <a name="operator+-4"></a>operator+ ( const <a href="qcstring.html">QCString</a> & s, char c )
|
---|
891 | </h3>
|
---|
892 | This 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 <a href="qcstring.html">QCString</a> <a name="operator+-5"></a>operator+ ( char c, const <a href="qcstring.html">QCString</a> & s )
|
---|
897 | </h3>
|
---|
898 | This 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< ( const <a href="qcstring.html">QCString</a> & s1, const char * 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>) < 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< ( const char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
911 | </h3>
|
---|
912 | This 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>) < 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> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qcstring.html">QCString</a> & 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<= ( const <a href="qcstring.html">QCString</a> & s1, const char * s2 )
|
---|
925 | </h3>
|
---|
926 |
|
---|
927 | <p>
|
---|
928 | <p> Returns TRUE if <em>s1</em> is less than or equal to <em>s2</em>; otherwise
|
---|
929 | returns FALSE.
|
---|
930 | <p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) <= 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<= ( const char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
934 | </h3>
|
---|
935 | This 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
|
---|
938 | returns FALSE.
|
---|
939 | <p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) <= 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 <a href="qcstring.html">QCString</a> & s1, const <a href="qcstring.html">QCString</a> & 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 <a href="qcstring.html">QCString</a> & s1, const char * s2 )
|
---|
950 | </h3>
|
---|
951 | This 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 char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
957 | </h3>
|
---|
958 | This 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> ( const <a href="qcstring.html">QCString</a> & s1, const char * 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>) > 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> ( const char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
972 | </h3>
|
---|
973 | This 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>) > 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>= ( const <a href="qcstring.html">QCString</a> & s1, const char * s2 )
|
---|
980 | </h3>
|
---|
981 |
|
---|
982 | <p>
|
---|
983 | <p> Returns TRUE if <em>s1</em> is greater than or equal to <em>s2</em>; otherwise
|
---|
984 | returns FALSE.
|
---|
985 | <p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) >= 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>= ( const char * s1, const <a href="qcstring.html">QCString</a> & s2 )
|
---|
989 | </h3>
|
---|
990 | This 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
|
---|
993 | returns FALSE.
|
---|
994 | <p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) >= 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> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qcstring.html">QCString</a> & 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 * dst, const void * src, uint len )
|
---|
1004 | </h3>
|
---|
1005 |
|
---|
1006 | <p> This function is normally part of the C library. Qt implements
|
---|
1007 | memmove() 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
|
---|
1009 | is copied correctly even if <em>src</em> and <em>dst</em> overlap.
|
---|
1010 |
|
---|
1011 | <h3 class=fn>int <a name="qstrcmp"></a>qstrcmp ( const char * str1, const char * 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>
|
---|
1017 | is less than <em>str2</em>, 0 if <em>str1</em> is equal to <em>str2</em> or a
|
---|
1018 | positive 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
|
---|
1021 | or <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 * dst, const char * src )
|
---|
1025 | </h3>
|
---|
1026 |
|
---|
1027 | <p>
|
---|
1028 | <p> A safe strcpy() function.
|
---|
1029 | <p> Copies all characters up to and including the '\0' from <em>src</em>
|
---|
1030 | into <em>dst</em> and returns a pointer to <em>dst</em>.
|
---|
1031 |
|
---|
1032 | <h3 class=fn>char * <a name="qstrdup"></a>qstrdup ( const char * 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
|
---|
1037 | pointer 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 char * str1, const char * 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
|
---|
1046 | than <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
|
---|
1049 | or <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 char * str )
|
---|
1053 | </h3>
|
---|
1054 |
|
---|
1055 | <p>
|
---|
1056 | <p> A safe strlen function.
|
---|
1057 | <p> Returns the number of characters that precede the terminating '\0'.
|
---|
1058 | or 0 if <em>str</em> is 0.
|
---|
1059 |
|
---|
1060 | <h3 class=fn>int <a name="qstrncmp"></a>qstrncmp ( const char * str1, const char * str2, uint 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
|
---|
1067 | than <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
|
---|
1070 | or <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 * dst, const char * src, uint 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
|
---|
1078 | terminating '\0' whichever comes first) into <em>dst</em> and returns a
|
---|
1079 | pointer to <em>dst</em>. Guarantees that <em>dst</em> is '\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 char * str1, const char * str2, uint 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>
|
---|
1089 | is 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
|
---|
1092 | or <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>
|
---|
1097 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
1098 | Copyright © 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 © 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>
|
---|