1QCString(3qt)                                                    QCString(3qt)
2
3
4

NAME

6       QCString - Abstraction of the classic C zero-terminated char array
7       (char *)
8

SYNOPSIS

10       All the functions in this class are reentrant when Qt is built with
11       thread support.</p>
12
13       #include <qcstring.h>
14
15       Inherits QByteArray.
16
17   Public Members
18       QCString ()
19       QCString ( int size )
20       QCString ( const QCString & s )
21       QCString ( const char * str )
22       QCString ( const char * str, uint maxsize )
23       QCString & operator= ( const QCString & s )
24       QCString & operator= ( const char * str )
25       bool isNull () const
26       bool isEmpty () const
27       uint length () const
28       bool resize ( uint len )
29       bool truncate ( uint pos )
30       bool fill ( char c, int len = -1 )
31       QCString copy () const
32       QCString & sprintf ( const char * format, ... )
33       int find ( char c, int index = 0, bool cs = TRUE ) const
34       int find ( const char * str, int index = 0, bool cs = TRUE ) const
35       int find ( const QRegExp & rx, int index = 0 ) const
36       int findRev ( char c, int index = -1, bool cs = TRUE ) const
37       int findRev ( const char * str, int index = -1, bool cs = TRUE ) const
38       int findRev ( const QRegExp & rx, int index = -1 ) const
39       int contains ( char c, bool cs = TRUE ) const
40       int contains ( const char * str, bool cs = TRUE ) const
41       int contains ( const QRegExp & rx ) const
42       QCString left ( uint len ) const
43       QCString right ( uint len ) const
44       QCString mid ( uint index, uint len = 0xffffffff ) const
45       QCString leftJustify ( uint width, char fill = ' ', bool truncate =
46           FALSE ) const
47       QCString rightJustify ( uint width, char fill = ' ', bool truncate =
48           FALSE ) const
49       QCString lower () const
50       QCString upper () const
51       QCString stripWhiteSpace () const
52       QCString simplifyWhiteSpace () const
53       QCString & insert ( uint index, const char * s )
54       QCString & insert ( uint index, char c )
55       QCString & append ( const char * str )
56       QCString & prepend ( const char * s )
57       QCString & remove ( uint index, uint len )
58       QCString & replace ( uint index, uint len, const char * str )
59       QCString & replace ( const QRegExp & rx, const char * str )
60       QCString & replace ( char c, const char * after )
61       QCString & replace ( const char * before, const char * after )
62       QCString & replace ( char c1, char c2 )
63       short toShort ( bool * ok = 0 ) const
64       ushort toUShort ( bool * ok = 0 ) const
65       int toInt ( bool * ok = 0 ) const
66       uint toUInt ( bool * ok = 0 ) const
67       long toLong ( bool * ok = 0 ) const
68       ulong toULong ( bool * ok = 0 ) const
69       float toFloat ( bool * ok = 0 ) const
70       double toDouble ( bool * ok = 0 ) const
71       QCString & setStr ( const char * str )
72       QCString & setNum ( short n )
73       QCString & setNum ( ushort n )
74       QCString & setNum ( int n )
75       QCString & setNum ( uint n )
76       QCString & setNum ( long n )
77       QCString & setNum ( ulong n )
78       QCString & setNum ( float n, char f = 'g', int prec = 6 )
79       QCString & setNum ( double n, char f = 'g', int prec = 6 )
80       bool setExpand ( uint index, char c )
81       operator const char * () const
82       QCString & operator+= ( const char * str )
83       QCString & operator+= ( char c )
84
86       void * qmemmove ( void * dst, const void * src, uint len )
87       char * qstrdup ( const char * src )
88       char * qstrcpy ( char * dst, const char * src )
89       char * qstrncpy ( char * dst, const char * src, uint len )
90       uint qstrlen ( const char * str )
91       int qstrcmp ( const char * str1, const char * str2 )
92       int qstrncmp ( const char * str1, const char * str2, uint len )
93       int qstricmp ( const char * str1, const char * str2 )
94       int qstrnicmp ( const char * str1, const char * str2, uint len )
95       QDataStream & operator<< ( QDataStream & s, const QCString & str )
96       QDataStream & operator>> ( QDataStream & s, QCString & str )
97       bool operator== ( const QCString & s1, const QCString & s2 )
98       bool operator== ( const QCString & s1, const char * s2 )
99       bool operator== ( const char * s1, const QCString & s2 )
100       bool operator!= ( const QCString & s1, const QCString & s2 )
101       bool operator!= ( const QCString & s1, const char * s2 )
102       bool operator!= ( const char * s1, const QCString & s2 )
103       bool operator< ( const QCString & s1, const char * s2 )
104       bool operator< ( const char * s1, const QCString & s2 )
105       bool operator<= ( const QCString & s1, const char * s2 )
106       bool operator<= ( const char * s1, const QCString & s2 )
107       bool operator> ( const QCString & s1, const char * s2 )
108       bool operator> ( const char * s1, const QCString & s2 )
109       bool operator>= ( const QCString & s1, const char * s2 )
110       bool operator>= ( const char * s1, const QCString & s2 )
111       const QCString operator+ ( const QCString & s1, const QCString & s2 )
112       const QCString operator+ ( const QCString & s1, const char * s2 )
113       const QCString operator+ ( const char * s1, const QCString & s2 )
114       const QCString operator+ ( const QCString & s, char c )
115       const QCString operator+ ( char c, const QCString & s )
116

DESCRIPTION

118       The QCString class provides an abstraction of the classic C zero-
119       terminated char array (char *).
120
121       QCString inherits QByteArray, which is defined as QMemArray<char>.
122       Since QCString is a QMemArray, it uses explicit sharing with a
123       reference count.
124
125       QCString tries to behave like a more convenient const char *. The price
126       of doing this is that some algorithms will perform badly. For example,
127       append() is O(length()) since it scans for a null terminator. Although
128       you might use QCString for text that is never exposed to the user, for
129       most purposes, and especially for user-visible text, you should use
130       QString. QString provides implicit sharing, Unicode and other
131       internationalization support, and is well optimized.
132
133       Note that for the QCString methods that take a const char * parameter
134       the const char * must either be 0 (null) or not-null and '&#92;0' (NUL
135       byte) terminated; otherwise the results are undefined.
136
137       A QCString that has not been assigned to anything is null, i.e. both
138       the length and the data pointer is 0. A QCString that references the
139       empty string ("", a single '&#92;0' char) is empty. Both null and empty
140       QCStrings are legal parameters to the methods. Assigning const char * 0
141       to QCString produces a null QCString.
142
143       The length() function returns the length of the string; resize()
144       resizes the string and truncate() truncates the string. A string can be
145       filled with a character using fill(). Strings can be left or right
146       padded with characters using leftJustify() and rightJustify().
147       Characters, strings and regular expressions can be searched for using
148       find() and findRev(), and counted using contains().
149
150       Strings and characters can be inserted with insert() and appended with
151       append(). A string can be prepended with prepend(). Characters can be
152       removed from the string with remove() and replaced with replace().
153
154       Portions of a string can be extracted using left(), right() and mid().
155       Whitespace can be removed using stripWhiteSpace() and
156       simplifyWhiteSpace(). Strings can be converted to uppercase or
157       lowercase with upper() and lower() respectively.
158
159       Strings that contain numbers can be converted to numbers with
160       toShort(), toInt(), toLong(), toULong(), toFloat() and toDouble().
161       Numbers can be converted to strings with setNum().
162
163       Many operators are overloaded to work with QCStrings. QCString also
164       supports some more obscure functions, e.g. sprintf(), setStr() and
165       setExpand().
166
167       <blockquote><p align="center"> Note on Character Comparisons
168
169       In QCString the notion of uppercase and lowercase and of which
170       character is greater than or less than another character is locale
171       dependent. This affects functions which support a case insensitive
172       option or which compare or lowercase or uppercase their arguments. Case
173       insensitive operations and comparisons will be accurate if both strings
174       contain only ASCII characters. (If $LC_CTYPE is set, most Unix systems
175       do "the right thing".) Functions that this affects include contains(),
176       find(), findRev(), operator<(), operator<=(), operator>(),
177       operator>=(), lower() and upper().
178
179       This issue does not apply to QStrings since they represent characters
180       using Unicode. </blockquote>
181
182       Performance note: The QCString methods for QRegExp searching are
183       implemented by converting the QCString to a QString and performing the
184       search on that. This implies a deep copy of the QCString data. If you
185       are going to perform many QRegExp searches on a large QCString, you
186       will get better performance by converting the QCString to a QString
187       yourself, and then searching in the QString.
188
189       See also Collection Classes, Implicitly and Explicitly Shared Classes,
190       Text Related Classes, and Non-GUI Classes.
191

MEMBER FUNCTION DOCUMENTATION

QCString::QCString ()

194       Constructs a null string.
195
196       See also isNull().
197

QCString::QCString ( int size )

199       Constructs a string with room for size characters, including the
200       '&#92;0'-terminator. Makes a null string if size == 0.
201
202       If size > 0, then the first and last characters in the string are
203       initialized to '&#92;0'. All other characters are uninitialized.
204
205       See also resize() and isNull().
206

QCString::QCString ( const QCString & s )

208       Constructs a shallow copy s.
209
210       See also assign().
211

QCString::QCString ( const char * str )

213       Constructs a string that is a deep copy of str.
214
215       If str is 0 a null string is created.
216
217       See also isNull().
218

QCString::QCString ( const char * str, uint maxsize )

220       Constructs a string that is a deep copy of str. The copy will be at
221       most maxsize bytes long including the '&#92;0'-terminator.
222
223       Example:
224
225           QCString str( "helloworld", 6 ); // assigns "hello" to str
226
227       If str contains a 0 byte within the first maxsize bytes, the resulting
228       QCString will be terminated by this 0. If str is 0 a null string is
229       created.
230
231       See also isNull().
232

QCString & QCString::append ( const char * str )

234       Appends string str to the string and returns a reference to the string.
235       Equivalent to operator+=().
236

int QCString::contains ( char c, bool cs = TRUE ) const

238       Returns the number of times the character c occurs in the string.
239
240       The match is case sensitive if cs is TRUE, or case insensitive if cs if
241       FALSE.
242
243       See also Note on character comparisons.
244

int QCString::contains ( const char * str, bool cs = TRUE ) const

246       This is an overloaded member function, provided for convenience. It
247       behaves essentially like the above function.
248
249       Returns the number of times str occurs in the string.
250
251       The match is case sensitive if cs is TRUE, or case insensitive if cs if
252       FALSE.
253
254       This function counts overlapping substrings, for example, "banana"
255       contains two occurrences of "ana".
256
257       See also findRev() and Note on character comparisons.
258

int QCString::contains ( const QRegExp & rx ) const

260       This is an overloaded member function, provided for convenience. It
261       behaves essentially like the above function.
262
263       Counts the number of overlapping occurrences of rx in the string.
264
265       Example:
266
267           QString s = "banana and panama";
268           QRegExp r = QRegExp( "a[nm]a", TRUE, FALSE );
269           s.contains( r ); // 4 matches
270
271       See also find() and findRev().
272
273       Warning: If you want to apply this function repeatedly to the same
274       string it is more efficient to convert the string to a QString and
275       apply the function to that.
276

QCString QCString::copy () const

278       Returns a deep copy of this string.
279
280       See also detach().
281

bool QCString::fill ( char c, int len = -1 )

283       Fills the string with len bytes of character c, followed by a
284       '&#92;0'-terminator.
285
286       If len is negative, then the current string length is used.
287
288       Returns FALSE is len is nonnegative and there is not enough memory to
289       resize the string; otherwise returns TRUE.
290

int QCString::find ( char c, int index = 0, bool cs = TRUE ) const

292       Finds the first occurrence of the character c, starting at position
293       index.
294
295       The search is case sensitive if cs is TRUE, or case insensitive if cs
296       is FALSE.
297
298       Returns the position of c, or -1 if c could not be found.
299
300       See also Note on character comparisons.
301
302       Example: network/networkprotocol/nntp.cpp.
303

int QCString::find ( const char * str, int index = 0, bool cs = TRUE ) const

305       This is an overloaded member function, provided for convenience. It
306       behaves essentially like the above function.
307
308       Finds the first occurrence of the string str, starting at position
309       index.
310
311       The search is case sensitive if cs is TRUE, or case insensitive if cs
312       is FALSE.
313
314       Returns the position of str, or -1 if str could not be found.
315
316       See also Note on character comparisons.
317

int QCString::find ( const QRegExp & rx, int index = 0 ) const

319       This is an overloaded member function, provided for convenience. It
320       behaves essentially like the above function.
321
322       Finds the first occurrence of the regular expression rx, starting at
323       position index.
324
325       Returns the position of the next match, or -1 if rx was not found.
326
327       Warning: If you want to apply this function repeatedly to the same
328       string it is more efficient to convert the string to a QString and
329       apply the function to that.
330

int QCString::findRev ( char c, int index = -1, bool cs = TRUE ) const

332       Finds the first occurrence of the character c, starting at position
333       index and searching backwards.
334
335       The search is case sensitive if cs is TRUE, or case insensitive if cs
336       is FALSE.
337
338       Returns the position of c, or -1 if c could not be found.
339
340       See also Note on character comparisons.
341

int QCString::findRev ( const char * str, int index = -1, bool cs = TRUE )

343       const
344       This is an overloaded member function, provided for convenience. It
345       behaves essentially like the above function.
346
347       Finds the first occurrence of the string str, starting at position
348       index and searching backwards.
349
350       The search is case sensitive if cs is TRUE, or case insensitive if cs
351       is FALSE.
352
353       Returns the position of str, or -1 if str could not be found.
354
355       See also Note on character comparisons.
356

int QCString::findRev ( const QRegExp & rx, int index = -1 ) const

358       This is an overloaded member function, provided for convenience. It
359       behaves essentially like the above function.
360
361       Finds the first occurrence of the regular expression rx, starting at
362       position index and searching backwards.
363
364       Returns the position of the next match (backwards), or -1 if rx was not
365       found.
366
367       Warning: If you want to apply this function repeatedly to the same
368       string it is more efficient to convert the string to a QString and
369       apply the function to that.
370

QCString & QCString::insert ( uint index, char c )

372       Inserts character c into the string at position index and returns a
373       reference to the string.
374
375       If index is beyond the end of the string, the string is padded with
376       spaces (ASCII 32) to length index and then c is appended.
377
378       Example:
379
380           QCString s = "Yes";
381           s.insert( 3, '!');   // s == "Yes!"
382
383       See also remove() and replace().
384

QCString & QCString::insert ( uint index, const char * s )

386       This is an overloaded member function, provided for convenience. It
387       behaves essentially like the above function.
388
389       Inserts string s into the string at position index.
390
391       If index is beyond the end of the string, the string is padded with
392       spaces (ASCII 32) to length index and then s is appended.
393
394           QCString s = "I like fish";
395           s.insert( 2, "don't ");     // s == "I don't like fish"
396           s = "x";                    // index 01234
397           s.insert( 3, "yz" );        // s == "x  yz"
398

bool QCString::isEmpty () const

400       Returns TRUE if the string is empty, i.e. if length() == 0; otherwise
401       returns FALSE. An empty string is not always a null string.
402
403       See example in isNull().
404
405       See also isNull(), length(), and size().
406

bool QCString::isNull () const

408       Returns TRUE if the string is null, i.e. if data() == 0; otherwise
409       returns FALSE. A null string is also an empty string.
410
411       Example:
412
413           QCString a;         // a.data() == 0,  a.size() == 0, a.length() == 0
414           QCString b == "";   // b.data() == "", b.size() == 1, b.length() == 0
415           a.isNull();         // TRUE  because a.data() == 0
416           a.isEmpty();        // TRUE  because a.length() == 0
417           b.isNull();         // FALSE because b.data() == ""
418           b.isEmpty();        // TRUE  because b.length() == 0
419
420       See also isEmpty(), length(), and size().
421

QCString QCString::left ( uint len ) const

423       Returns a substring that contains the len leftmost characters of the
424       string.
425
426       The whole string is returned if len exceeds the length of the string.
427
428       Example:
429
430           QCString s = "Pineapple";
431           QCString t = s.left( 4 );  // t == "Pine"
432
433       See also right() and mid().
434
435       Example: network/networkprotocol/nntp.cpp.
436

QCString QCString::leftJustify ( uint width, char fill = ' ', bool truncate =

438       FALSE ) const
439       Returns a string of length width (plus one for the terminating
440       '&#92;0') that contains this string padded with the fill character.
441
442       If the length of the string exceeds width and truncate is FALSE (the
443       default), then the returned string is a copy of the string. If the
444       length of the string exceeds width and truncate is TRUE, then the
445       returned string is a left(width).
446
447       Example:
448
449           QCString s("apple");
450           QCString t = s.leftJustify(8, '.');  // t == "apple..."
451
452       See also rightJustify().
453

uint QCString::length () const

455       Returns the length of the string, excluding the '&#92;0'-terminator.
456       Equivalent to calling strlen(data()).
457
458       Null strings and empty strings have zero length.
459
460       See also size(), isNull(), and isEmpty().
461
462       Example: network/networkprotocol/nntp.cpp.
463

QCString QCString::lower () const

465       Returns a new string that is a copy of this string converted to lower
466       case.
467
468       Example:
469
470           QCString s("Credit");
471           QCString t = s.lower();  // t == "credit"
472
473       See also upper() and Note on character comparisons.
474

QCString QCString::mid ( uint index, uint len = 0xffffffff ) const

476       Returns a substring that contains at most len characters from this
477       string, starting at position index.
478
479       Returns a null string if the string is empty or if index is out of
480       range. Returns the whole string from index if index+len exceeds the
481       length of the string.
482
483       Example:
484
485           QCString s = "Two pineapples";
486           QCString t = s.mid( 4, 3 );     // t == "pin"
487
488       See also left() and right().
489
490       Example: network/networkprotocol/nntp.cpp.
491

QCString::operator const char * () const

493       Returns the string data.
494

QCString & QCString::operator+= ( const char * str )

496       Appends string str to the string and returns a reference to the string.
497

QCString & QCString::operator+= ( char c )

499       This is an overloaded member function, provided for convenience. It
500       behaves essentially like the above function.
501
502       Appends character c to the string and returns a reference to the
503       string.
504

QCString & QCString::operator= ( const QCString & s )

506       Assigns a shallow copy of s to this string and returns a reference to
507       this string.
508

QCString & QCString::operator= ( const char * str )

510       This is an overloaded member function, provided for convenience. It
511       behaves essentially like the above function.
512
513       Assigns a deep copy of str to this string and returns a reference to
514       this string.
515
516       If str is 0 a null string is created.
517
518       See also isNull().
519

QCString & QCString::prepend ( const char * s )

521       Prepend s to the string. Equivalent to insert(0, s).
522
523       See also insert().
524

QCString & QCString::remove ( uint index, uint len )

526       Removes len characters from the string, starting at position index, and
527       returns a reference to the string.
528
529       If index is out of range, nothing happens. If index is valid, but index
530       + len is larger than the length of the string, the string is truncated
531       at position index.
532
533           QCString s = "Montreal";
534           s.remove( 1, 4 );         // s == "Meal"
535
536       See also insert() and replace().
537
538       Example: network/networkprotocol/nntp.cpp.
539

QCString & QCString::replace ( uint index, uint len, const char * str )

541       Replaces len characters from the string, starting at position index,
542       with str, and returns a reference to the string.
543
544       If index is out of range, nothing is removed and str is appended at the
545       end of the string. If index is valid, but index + len is larger than
546       the length of the string, str replaces the rest of the string from
547       position index.
548
549           QCString s = "Say yes!";
550           s.replace( 4, 3, "NO" );  // s == "Say NO!"
551
552       See also insert() and remove().
553

QCString & QCString::replace ( const QRegExp & rx, const char * str )

555       This is an overloaded member function, provided for convenience. It
556       behaves essentially like the above function.
557
558       Replaces every occurrence of rx in the string with str. Returns a
559       reference to the string.
560
561       Example:
562
563           QString s = "banana";
564           s.replace( QRegExp("a.*a"), "" );     // becomes "b"
565           s = "banana";
566           s.replace( QRegExp("^[bn]a"), "X" );  // becomes "Xnana"
567           s = "banana";
568           s.replace( QRegExp("^[bn]a"), "" );   // becomes "nana"
569
570       Warning: If you want to apply this function repeatedly to the same
571       string it is more efficient to convert the string to a QString and
572       apply the function to that.
573

QCString & QCString::replace ( char c, const char * after )

575       This is an overloaded member function, provided for convenience. It
576       behaves essentially like the above function.
577
578       Replaces every occurrence of the character c in the string with after.
579       Returns a reference to the string.
580
581       Example:
582
583           QCString s = "a,b,c";
584           s.replace( ',', " or " );
585           // s == "a or b or c"
586

QCString & QCString::replace ( const char * before, const char * after )

588       This is an overloaded member function, provided for convenience. It
589       behaves essentially like the above function.
590
591       Replaces every occurrence of the string before in the string with the
592       string after. Returns a reference to the string.
593
594       Example:
595
596           QCString s = "Greek is Greek";
597           s.replace( "Greek", "English" );
598           // s == "English is English"
599

QCString & QCString::replace ( char c1, char c2 )

601       This is an overloaded member function, provided for convenience. It
602       behaves essentially like the above function.
603
604       Replaces every occurrence of c1 with the char c2. Returns a reference
605       to the string.
606

bool QCString::resize ( uint len )

608       Extends or shrinks the string to len bytes, including the
609       '&#92;0'-terminator.
610
611       A '&#92;0'-terminator is set at position len - 1 unless len == 0.
612
613       Example:
614
615           QCString s = "resize this string";
616           s.resize( 7 );                      // s == "resize"
617
618       See also truncate().
619
620       Example: network/networkprotocol/nntp.cpp.
621

QCString QCString::right ( uint len ) const

623       Returns a substring that contains the len rightmost characters of the
624       string.
625
626       The whole string is returned if len exceeds the length of the string.
627
628       Example:
629
630           QCString s = "Pineapple";
631           QCString t = s.right( 5 );  // t == "apple"
632
633       See also left() and mid().
634
635       Example: network/networkprotocol/nntp.cpp.
636

QCString QCString::rightJustify ( uint width, char fill = ' ', bool truncate =

638       FALSE ) const
639       Returns a string of length width (plus one for the terminating
640       '&#92;0') that contains zero or more of the fill character followed by
641       this string.
642
643       If the length of the string exceeds width and truncate is FALSE (the
644       default), then the returned string is a copy of the string. If the
645       length of the string exceeds width and truncate is TRUE, then the
646       returned string is a left(width).
647
648       Example:
649
650           QCString s("pie");
651           QCString t = s.rightJustify(8, '.');  // t == ".....pie"
652
653       See also leftJustify().
654

bool QCString::setExpand ( uint index, char c )

656       Sets the character at position index to c and expands the string if
657       necessary, padding with spaces.
658
659       Returns FALSE if index was out of range and the string could not be
660       expanded; otherwise returns TRUE.
661

QCString & QCString::setNum ( double n, char f = 'g', int prec = 6 )

663       Sets the string to the string representation of the number n and
664       returns a reference to the string.
665
666       The format of the string representation is specified by the format
667       character f, and the precision (number of digits after the decimal
668       point) is specified with prec.
669
670       The valid formats for f are 'e', 'E', 'f', 'g' and 'G'. The formats are
671       the same as for sprintf(); they are explained in QString::arg().
672

QCString & QCString::setNum ( short n )

674       This is an overloaded member function, provided for convenience. It
675       behaves essentially like the above function.
676
677       Sets the string to the string representation of the number n and
678       returns a reference to the string.
679

QCString & QCString::setNum ( ushort n )

681       This is an overloaded member function, provided for convenience. It
682       behaves essentially like the above function.
683
684       Sets the string to the string representation of the number n and
685       returns a reference to the string.
686

QCString & QCString::setNum ( int n )

688       This is an overloaded member function, provided for convenience. It
689       behaves essentially like the above function.
690
691       Sets the string to the string representation of the number n and
692       returns a reference to the string.
693

QCString & QCString::setNum ( uint n )

695       This is an overloaded member function, provided for convenience. It
696       behaves essentially like the above function.
697
698       Sets the string to the string representation of the number n and
699       returns a reference to the string.
700

QCString & QCString::setNum ( long n )

702       This is an overloaded member function, provided for convenience. It
703       behaves essentially like the above function.
704
705       Sets the string to the string representation of the number n and
706       returns a reference to the string.
707

QCString & QCString::setNum ( ulong n )

709       This is an overloaded member function, provided for convenience. It
710       behaves essentially like the above function.
711
712       Sets the string to the string representation of the number n and
713       returns a reference to the string.
714

QCString & QCString::setNum ( float n, char f = 'g', int prec = 6 )

716       This is an overloaded member function, provided for convenience. It
717       behaves essentially like the above function.
718

QCString & QCString::setStr ( const char * str )

720       Makes a deep copy of str. Returns a reference to the string.
721

QCString QCString::simplifyWhiteSpace () const

723       Returns a new string that has white space removed from the start and
724       the end, plus any sequence of internal white space replaced with a
725       single space (ASCII 32).
726
727       White space means the decimal ASCII codes 9, 10, 11, 12, 13 and 32.
728
729           QCString s = "  lots\t of\nwhite    space ";
730           QCString t = s.simplifyWhiteSpace(); // t == "lots of white space"
731
732       See also stripWhiteSpace().
733

QCString & QCString::sprintf ( const char * format, ... )

735       Implemented as a call to the native vsprintf() (see the manual for your
736       C library).
737
738       If the string is shorter than 256 characters, this sprintf() calls
739       resize(256) to decrease the chance of memory corruption. The string is
740       resized back to its actual length before sprintf() returns.
741
742       Example:
743
744           QCString s;
745           s.sprintf( "%d - %s", 1, "first" );         // result < 256 chars
746           QCString big( 25000 );                      // very long string
747           big.sprintf( "%d - %s", 2, longString );    // result < 25000 chars
748
749       Warning: All vsprintf() implementations will write past the end of the
750       target string (*this) if the format specification and arguments happen
751       to be longer than the target string, and some will also fail if the
752       target string is longer than some arbitrary implementation limit.
753
754       Giving user-supplied arguments to sprintf() is risky: Sooner or later
755       someone will paste a huge line into your application.
756

QCString QCString::stripWhiteSpace () const

758       Returns a new string that has white space removed from the start and
759       the end.
760
761       White space means the decimal ASCII codes 9, 10, 11, 12, 13 and 32.
762
763       Example:
764
765           QCString s = " space ";
766           QCString t = s.stripWhiteSpace();           // t == "space"
767
768       See also simplifyWhiteSpace().
769

double QCString::toDouble ( bool * ok = 0 ) const

771       Returns the string converted to a double value.
772
773       If ok is not 0: *ok is set to FALSE if the string is not a number, or
774       if it has trailing garbage; otherwise *ok is set to TRUE.
775

float QCString::toFloat ( bool * ok = 0 ) const

777       Returns the string converted to a float value.
778
779       If ok is not 0: *ok is set to FALSE if the string is not a number, or
780       if it has trailing garbage; otherwise *ok is set to TRUE.
781

int QCString::toInt ( bool * ok = 0 ) const

783       Returns the string converted to a int value.
784
785       If ok is not 0: *ok is set to FALSE if the string is not a number, or
786       if it has trailing garbage; otherwise *ok is set to TRUE.
787

long QCString::toLong ( bool * ok = 0 ) const

789       Returns the string converted to a long value.
790
791       If ok is not 0: *ok is set to FALSE if the string is not a number, or
792       if it has trailing garbage; otherwise *ok is set to TRUE.
793

short QCString::toShort ( bool * ok = 0 ) const

795       Returns the string converted to a short value.
796
797       If ok is not 0: *ok is set to FALSE if the string is not a number, is
798       out of range, or if it has trailing garbage; otherwise *ok is set to
799       TRUE.
800

uint QCString::toUInt ( bool * ok = 0 ) const

802       Returns the string converted to an unsigned int value.
803
804       If ok is not 0: *ok is set to FALSE if the string is not a number, or
805       if it has trailing garbage; otherwise *ok is set to TRUE.
806

ulong QCString::toULong ( bool * ok = 0 ) const

808       Returns the string converted to an unsigned long value.
809
810       If ok is not 0: *ok is set to FALSE if the string is not a number, or
811       if it has trailing garbage; otherwise *ok is set to TRUE.
812

ushort QCString::toUShort ( bool * ok = 0 ) const

814       Returns the string converted to an unsigned short value.
815
816       If ok is not 0: *ok is set to FALSE if the string is not a number, is
817       out of range, or if it has trailing garbage; otherwise *ok is set to
818       TRUE.
819

bool QCString::truncate ( uint pos )

821       Truncates the string at position pos.
822
823       Equivalent to calling resize(pos+1).
824
825       Example:
826
827           QCString s = "truncate this string";
828           s.truncate( 5 );                      // s == "trunc"
829
830       See also resize().
831

QCString QCString::upper () const

833       Returns a new string that is a copy of this string converted to upper
834       case.
835
836       Example:
837
838           QCString s( "Debit" );
839           QCString t = s.upper();  // t == "DEBIT"
840
841       See also lower() and Note on character comparisons.
842

bool operator!= ( const QCString & s1, const QCString & s2 )

845       Returns TRUE if s1 and s2 are different; otherwise returns FALSE.
846
847       Equivalent to qstrcmp(s1, s2) != 0.
848

bool operator!= ( const QCString & s1, const char * s2 )

850       This is an overloaded member function, provided for convenience. It
851       behaves essentially like the above function.
852
853       Returns TRUE if s1 and s2 are different; otherwise returns FALSE.
854
855       Equivalent to qstrcmp(s1, s2) != 0.
856

bool operator!= ( const char * s1, const QCString & s2 )

858       This is an overloaded member function, provided for convenience. It
859       behaves essentially like the above function.
860
861       Returns TRUE if s1 and s2 are different; otherwise returns FALSE.
862
863       Equivalent to qstrcmp(s1, s2) != 0.
864

const QCString operator+ ( const QCString & s1, const QCString & s2 )

866       Returns a string which consists of the concatenation of s1 and s2.
867

const QCString operator+ ( const QCString & s1, const char * s2 )

869       This is an overloaded member function, provided for convenience. It
870       behaves essentially like the above function.
871
872       Returns a string which consists of the concatenation of s1 and s2.
873

const QCString operator+ ( const char * s1, const QCString & s2 )

875       This is an overloaded member function, provided for convenience. It
876       behaves essentially like the above function.
877
878       Returns a string which consists of the concatenation of s1 and s2.
879

const QCString operator+ ( const QCString & s, char c )

881       This is an overloaded member function, provided for convenience. It
882       behaves essentially like the above function.
883
884       Returns a string which consists of the concatenation of s and c.
885

const QCString operator+ ( char c, const QCString & s )

887       This is an overloaded member function, provided for convenience. It
888       behaves essentially like the above function.
889
890       Returns a string which consists of the concatenation of c and s.
891

bool operator< ( const QCString & s1, const char * s2 )

893       Returns TRUE if s1 is less than s2; otherwise returns FALSE.
894
895       Equivalent to qstrcmp(s1, s2) < 0.
896
897       See also Note on character comparisons.
898

bool operator< ( const char * s1, const QCString & s2 )

900       This is an overloaded member function, provided for convenience. It
901       behaves essentially like the above function.
902
903       Returns TRUE if s1 is less than s2; otherwise returns FALSE.
904
905       Equivalent to qstrcmp(s1, s2) < 0.
906
907       See also Note on character comparisons.
908

QDataStream & operator<< ( QDataStream & s, const QCString & str )

910       Writes string str to the stream s.
911
912       See also Format of the QDataStream operators.
913

bool operator<= ( const QCString & s1, const char * s2 )

915       Returns TRUE if s1 is less than or equal to s2; otherwise returns
916       FALSE.
917
918       Equivalent to qstrcmp(s1, s2) <= 0.
919
920       See also Note on character comparisons.
921

bool operator<= ( const char * s1, const QCString & s2 )

923       This is an overloaded member function, provided for convenience. It
924       behaves essentially like the above function.
925
926       Returns TRUE if s1 is less than or equal to s2; otherwise returns
927       FALSE.
928
929       Equivalent to qstrcmp(s1, s2) <= 0.
930
931       See also Note on character comparisons.
932

bool operator== ( const QCString & s1, const QCString & s2 )

934       Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.
935
936       Equivalent to qstrcmp(s1, s2) == 0.
937

bool operator== ( const QCString & s1, const char * s2 )

939       This is an overloaded member function, provided for convenience. It
940       behaves essentially like the above function.
941
942       Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.
943
944       Equivalent to qstrcmp(s1, s2) == 0.
945

bool operator== ( const char * s1, const QCString & s2 )

947       This is an overloaded member function, provided for convenience. It
948       behaves essentially like the above function.
949
950       Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.
951
952       Equivalent to qstrcmp(s1, s2) == 0.
953

bool operator> ( const QCString & s1, const char * s2 )

955       Returns TRUE if s1 is greater than s2; otherwise returns FALSE.
956
957       Equivalent to qstrcmp(s1, s2) > 0.
958
959       See also Note on character comparisons.
960

bool operator> ( const char * s1, const QCString & s2 )

962       This is an overloaded member function, provided for convenience. It
963       behaves essentially like the above function.
964
965       Returns TRUE if s1 is greater than s2; otherwise returns FALSE.
966
967       Equivalent to qstrcmp(s1, s2) > 0.
968
969       See also Note on character comparisons.
970

bool operator>= ( const QCString & s1, const char * s2 )

972       Returns TRUE if s1 is greater than or equal to s2; otherwise returns
973       FALSE.
974
975       Equivalent to qstrcmp(s1, s2) >= 0.
976
977       See also Note on character comparisons.
978

bool operator>= ( const char * s1, const QCString & s2 )

980       This is an overloaded member function, provided for convenience. It
981       behaves essentially like the above function.
982
983       Returns TRUE if s1 is greater than or equal to s2; otherwise returns
984       FALSE.
985
986       Equivalent to qstrcmp(s1, s2) >= 0.
987
988       See also Note on character comparisons.
989

QDataStream & operator>> ( QDataStream & s, QCString & str )

991       Reads a string into str from the stream s.
992
993       See also Format of the QDataStream operators.
994

void * qmemmove ( void * dst, const void * src, uint len )

996       This function is normally part of the C library. Qt implements
997       memmove() for platforms that do not provide it.
998
999       memmove() copies len bytes from src into dst. The data is copied
1000       correctly even if src and dst overlap.
1001

int qstrcmp ( const char * str1, const char * str2 )

1003       A safe strcmp() function.
1004
1005       Compares str1 and str2. Returns a negative value if str1 is less than
1006       str2, 0 if str1 is equal to str2 or a positive value if str1 is greater
1007       than str2.
1008
1009       Special case I: Returns 0 if str1 and str2 are both 0.
1010
1011       Special case II: Returns a random nonzero value if str1 is 0 or str2 is
1012       0 (but not both).
1013
1014       See also qstrncmp(), qstricmp(), qstrnicmp(), and Note on character
1015       comparisons.
1016

char * qstrcpy ( char * dst, const char * src )

1018       A safe strcpy() function.
1019
1020       Copies all characters up to and including the '&#92;0' from src into
1021       dst and returns a pointer to dst.
1022

char * qstrdup ( const char * src )

1024       Returns a duplicate string.
1025
1026       Allocates space for a copy of src, copies it, and returns a pointer to
1027       the copy. If src is 0, it immediately returns 0.
1028
1029       The returned string must be deleted using delete[].
1030

int qstricmp ( const char * str1, const char * str2 )

1032       A safe stricmp() function.
1033
1034       Compares str1 and str2 ignoring the case.
1035
1036       Returns a negative value if str1 is less than str2, 0 if str1 is equal
1037       to str2 or a positive value if str1 is greater than str2.
1038
1039       Special case I: Returns 0 if str1 and str2 are both 0.
1040
1041       Special case II: Returns a random nonzero value if str1 is 0 or str2 is
1042       0 (but not both).
1043
1044       See also qstrcmp(), qstrncmp(), qstrnicmp(), and Note on character
1045       comparisons.
1046

uint qstrlen ( const char * str )

1048       A safe strlen function.
1049
1050       Returns the number of characters that precede the terminating '&#92;0'.
1051       or 0 if str is 0.
1052

int qstrncmp ( const char * str1, const char * str2, uint len )

1054       A safe strncmp() function.
1055
1056       Compares at most len bytes of str1 and str2.
1057
1058       Returns a negative value if str1 is less than str2, 0 if str1 is equal
1059       to str2 or a positive value if str1 is greater than str2.
1060
1061       Special case I: Returns 0 if str1 and str2 are both 0.
1062
1063       Special case II: Returns a random nonzero value if str1 is 0 or str2 is
1064       0 (but not both).
1065
1066       See also qstrcmp(), qstricmp(), qstrnicmp(), and Note on character
1067       comparisons.
1068

char * qstrncpy ( char * dst, const char * src, uint len )

1070       A safe strncpy() function.
1071
1072       Copies at most len bytes from src (stopping at len or the terminating
1073       '&#92;0' whichever comes first) into dst and returns a pointer to dst.
1074       Guarantees that dst is '&#92;0'-terminated. If src or dst is 0, returns
1075       0 immediately.
1076
1077       See also qstrcpy().
1078

int qstrnicmp ( const char * str1, const char * str2, uint len )

1080       A safe strnicmp() function.
1081
1082       Compares at most len bytes of str1 and str2 ignoring the case.
1083
1084       Returns a negative value if str1 is less than str2, 0 if str1 is equal
1085       to str2 or a positive value if str1 is greater than str2.
1086
1087       Special case I: Returns 0 if str1 and str2 are both 0.
1088
1089       Special case II: Returns a random nonzero value if str1 is 0 or str2 is
1090       0 (but not both).
1091
1092       See also qstrcmp(), qstrncmp(), qstricmp(), and Note on character
1093       comparisons.
1094
1095

SEE ALSO

1097       http://doc.trolltech.com/qcstring.html
1098       http://www.trolltech.com/faq/tech.html
1099
1101       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
1102       license file included in the distribution for a complete license
1103       statement.
1104

AUTHOR

1106       Generated automatically from the source code.
1107

BUGS

1109       If you find a bug in Qt, please report it as described in
1110       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
1111       help you. Thank you.
1112
1113       The definitive Qt documentation is provided in HTML format; it is
1114       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
1115       web browser. This man page is provided as a convenience for those users
1116       who prefer man pages, although this format is not officially supported
1117       by Trolltech.
1118
1119       If you find errors in this manual page, please report them to qt-
1120       bugs@trolltech.com.  Please include the name of the manual page
1121       (qcstring.3qt) and the Qt version (3.3.8).
1122
1123
1124
1125Trolltech AS                    2 February 2007                  QCString(3qt)
Impressum