You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1106 lines
63 KiB
1106 lines
63 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
5 months ago
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/tqcstring.cpp:567 -->
|
||
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQCString Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQCString Class Reference</h1>
|
||
|
|
||
|
<p>The TQCString class provides an abstraction of the classic C
|
||
|
zero-terminated char array (char *).
|
||
|
<a href="#details">More...</a>
|
||
|
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
|
||
5 months ago
|
<p><tt>#include <<a href="tqcstring-h.html">tqcstring.h</a>></tt>
|
||
|
<p>Inherits <a href="tqbytearray.html">TQByteArray</a>.
|
||
|
<p><a href="tqcstring-members.html">List of all member functions.</a>
|
||
13 years ago
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQCString"><b>TQCString</b></a> ()</li>
|
||
|
<li class=fn><a href="#TQCString-2"><b>TQCString</b></a> ( int size )</li>
|
||
|
<li class=fn><a href="#TQCString-3"><b>TQCString</b></a> ( const TQCString & s )</li>
|
||
|
<li class=fn><a href="#TQCString-4"><b>TQCString</b></a> ( const char * str )</li>
|
||
|
<li class=fn><a href="#TQCString-5"><b>TQCString</b></a> ( const char * str, uint maxsize )</li>
|
||
|
<li class=fn>TQCString & <a href="#operator-eq"><b>operator=</b></a> ( const TQCString & s )</li>
|
||
|
<li class=fn>TQCString & <a href="#operator-eq-2"><b>operator=</b></a> ( const char * str )</li>
|
||
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
|
||
|
<li class=fn>uint <a href="#length"><b>length</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#resize"><b>resize</b></a> ( uint len )</li>
|
||
|
<li class=fn>bool <a href="#truncate"><b>truncate</b></a> ( uint pos )</li>
|
||
|
<li class=fn>bool <a href="#fill"><b>fill</b></a> ( char c, int len = -1 )</li>
|
||
|
<li class=fn>TQCString <a href="#copy"><b>copy</b></a> () const</li>
|
||
|
<li class=fn>TQCString & <a href="#sprintf"><b>sprintf</b></a> ( const char * format, ... )</li>
|
||
|
<li class=fn>int <a href="#find"><b>find</b></a> ( char c, int index = 0, bool cs = TRUE ) const</li>
|
||
|
<li class=fn>int <a href="#find-2"><b>find</b></a> ( const char * str, int index = 0, bool cs = TRUE ) const</li>
|
||
|
<li class=fn>int <a href="#find-3"><b>find</b></a> ( const TQRegExp & rx, int index = 0 ) const</li>
|
||
|
<li class=fn>int <a href="#findRev"><b>findRev</b></a> ( char c, int index = -1, bool cs = TRUE ) const</li>
|
||
|
<li class=fn>int <a href="#findRev-2"><b>findRev</b></a> ( const char * str, int index = -1, bool cs = TRUE ) const</li>
|
||
|
<li class=fn>int <a href="#findRev-3"><b>findRev</b></a> ( const TQRegExp & rx, int index = -1 ) const</li>
|
||
|
<li class=fn>int <a href="#contains"><b>contains</b></a> ( char c, bool cs = TRUE ) const</li>
|
||
|
<li class=fn>int <a href="#contains-2"><b>contains</b></a> ( const char * str, bool cs = TRUE ) const</li>
|
||
|
<li class=fn>int <a href="#contains-3"><b>contains</b></a> ( const TQRegExp & rx ) const</li>
|
||
|
<li class=fn>TQCString <a href="#left"><b>left</b></a> ( uint len ) const</li>
|
||
|
<li class=fn>TQCString <a href="#right"><b>right</b></a> ( uint len ) const</li>
|
||
|
<li class=fn>TQCString <a href="#mid"><b>mid</b></a> ( uint index, uint len = 0xffffffff ) const</li>
|
||
|
<li class=fn>TQCString <a href="#leftJustify"><b>leftJustify</b></a> ( uint width, char fill = ' ', bool truncate = FALSE ) const</li>
|
||
|
<li class=fn>TQCString <a href="#rightJustify"><b>rightJustify</b></a> ( uint width, char fill = ' ', bool truncate = FALSE ) const</li>
|
||
|
<li class=fn>TQCString <a href="#lower"><b>lower</b></a> () const</li>
|
||
|
<li class=fn>TQCString <a href="#upper"><b>upper</b></a> () const</li>
|
||
|
<li class=fn>TQCString <a href="#stripWhiteSpace"><b>stripWhiteSpace</b></a> () const</li>
|
||
|
<li class=fn>TQCString <a href="#simplifyWhiteSpace"><b>simplifyWhiteSpace</b></a> () const</li>
|
||
|
<li class=fn>TQCString & <a href="#insert-2"><b>insert</b></a> ( uint index, const char * s )</li>
|
||
|
<li class=fn>TQCString & <a href="#insert"><b>insert</b></a> ( uint index, char c )</li>
|
||
|
<li class=fn>TQCString & <a href="#append"><b>append</b></a> ( const char * str )</li>
|
||
|
<li class=fn>TQCString & <a href="#prepend"><b>prepend</b></a> ( const char * s )</li>
|
||
|
<li class=fn>TQCString & <a href="#remove"><b>remove</b></a> ( uint index, uint len )</li>
|
||
|
<li class=fn>TQCString & <a href="#replace"><b>replace</b></a> ( uint index, uint len, const char * str )</li>
|
||
|
<li class=fn>TQCString & <a href="#replace-2"><b>replace</b></a> ( const TQRegExp & rx, const char * str )</li>
|
||
|
<li class=fn>TQCString & <a href="#replace-3"><b>replace</b></a> ( char c, const char * after )</li>
|
||
|
<li class=fn>TQCString & <a href="#replace-4"><b>replace</b></a> ( const char * before, const char * after )</li>
|
||
|
<li class=fn>TQCString & <a href="#replace-5"><b>replace</b></a> ( char c1, char c2 )</li>
|
||
|
<li class=fn>short <a href="#toShort"><b>toShort</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>ushort <a href="#toUShort"><b>toUShort</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>long <a href="#toLong"><b>toLong</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>ulong <a href="#toULong"><b>toULong</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>float <a href="#toFloat"><b>toFloat</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool * ok = 0 ) const</li>
|
||
|
<li class=fn>TQCString & <a href="#setStr"><b>setStr</b></a> ( const char * str )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-2"><b>setNum</b></a> ( short n )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-3"><b>setNum</b></a> ( ushort n )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-4"><b>setNum</b></a> ( int n )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-5"><b>setNum</b></a> ( uint n )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-6"><b>setNum</b></a> ( long n )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-7"><b>setNum</b></a> ( ulong n )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum-8"><b>setNum</b></a> ( float n, char f = 'g', int prec = 6 )</li>
|
||
|
<li class=fn>TQCString & <a href="#setNum"><b>setNum</b></a> ( double n, char f = 'g', int prec = 6 )</li>
|
||
|
<li class=fn>bool <a href="#setExpand"><b>setExpand</b></a> ( uint index, char c )</li>
|
||
|
<li class=fn><a href="#operator-const-char-*"><b>operator const char *</b></a> () const</li>
|
||
|
<li class=fn>TQCString & <a href="#operator+-eq"><b>operator+=</b></a> ( const char * str )</li>
|
||
|
<li class=fn>TQCString & <a href="#operator+-eq-2"><b>operator+=</b></a> ( char c )</li>
|
||
|
</ul>
|
||
|
<h2>Related Functions</h2>
|
||
|
<ul>
|
||
12 years ago
|
<li class=fn>void * <a href="#qmemmove"><b>tqmemmove</b></a> ( void * dst, const void * src, uint len )</li>
|
||
|
<li class=fn>char * <a href="#qstrdup"><b>tqstrdup</b></a> ( const char * src )</li>
|
||
13 years ago
|
<li class=fn>char * <a href="#qstrcpy"><b>qstrcpy</b></a> ( char * dst, const char * src )</li>
|
||
12 years ago
|
<li class=fn>char * <a href="#qstrncpy"><b>tqstrncpy</b></a> ( char * dst, const char * src, uint len )</li>
|
||
|
<li class=fn>uint <a href="#qstrlen"><b>tqstrlen</b></a> ( const char * str )</li>
|
||
13 years ago
|
<li class=fn>int <a href="#qstrcmp"><b>qstrcmp</b></a> ( const char * str1, const char * str2 )</li>
|
||
12 years ago
|
<li class=fn>int <a href="#qstrncmp"><b>tqstrncmp</b></a> ( const char * str1, const char * str2, uint len )</li>
|
||
|
<li class=fn>int <a href="#qstricmp"><b>tqstricmp</b></a> ( const char * str1, const char * str2 )</li>
|
||
|
<li class=fn>int <a href="#qstrnicmp"><b>tqstrnicmp</b></a> ( const char * str1, const char * str2, uint len )</li>
|
||
13 years ago
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQCString & str )</li>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQCString & str )</li>
|
||
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQCString & s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-eq-eq-3"><b>operator==</b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQCString & s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator!-eq-2"><b>operator!=</b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator!-eq-3"><b>operator!=</b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-lt"><b>operator<</b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-lt-2"><b>operator<</b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-lt-eq"><b>operator<=</b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-lt-eq-2"><b>operator<=</b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-gt"><b>operator></b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-gt-2"><b>operator></b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-gt-eq"><b>operator>=</b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>bool <a href="#operator-gt-eq-2"><b>operator>=</b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>const TQCString <a href="#operator+"><b>operator+</b></a> ( const TQCString & s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>const TQCString <a href="#operator+-2"><b>operator+</b></a> ( const TQCString & s1, const char * s2 )</li>
|
||
|
<li class=fn>const TQCString <a href="#operator+-3"><b>operator+</b></a> ( const char * s1, const TQCString & s2 )</li>
|
||
|
<li class=fn>const TQCString <a href="#operator+-4"><b>operator+</b></a> ( const TQCString & s, char c )</li>
|
||
|
<li class=fn>const TQCString <a href="#operator+-5"><b>operator+</b></a> ( char c, const TQCString & s )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
|
||
|
The TQCString class provides an abstraction of the classic C
|
||
|
zero-terminated char array (char *).
|
||
|
<p>
|
||
|
|
||
|
|
||
|
|
||
5 months ago
|
<p> TQCString inherits <a href="tqbytearray.html">TQByteArray</a>, which is defined as
|
||
|
<a href="tqmemarray.html">TQMemArray</a><char>. Since TQCString is a TQMemArray, it uses <a href="shclass.html">explicit sharing</a> with a reference count.
|
||
13 years ago
|
<p> TQCString tries to behave like a more convenient <tt>const char *</tt>.
|
||
|
The price of doing this is that some algorithms will perform
|
||
|
badly. For example, <a href="#append">append</a>() is O(length()) since it scans for a
|
||
|
null terminator. Although you might use TQCString for text that is
|
||
|
never exposed to the user, for most purposes, and especially for
|
||
6 months ago
|
user-visible text, you should use <a href="tqstring.html">TQString</a>. TQString provides
|
||
13 years ago
|
<a href="shclass.html#implicit-sharing">implicit sharing</a>, Unicode and other <a href="i18n.html#internationalization">internationalization</a> support,
|
||
|
and is well optimized.
|
||
|
<p> Note that for the TQCString methods that take a <tt>const char *</tt>
|
||
|
parameter the <tt>const char *</tt> must either be 0 (null) or not-null
|
||
|
and '\0' (NUL byte) terminated; otherwise the results are
|
||
|
undefined.
|
||
|
<p> A TQCString that has not been assigned to anything is <em>null</em>, i.e.
|
||
|
both the length and the data pointer is 0. A TQCString that
|
||
|
references the empty string ("", a single '\0' char) is <em>empty</em>.
|
||
|
Both null and empty TQCStrings are legal parameters to the methods.
|
||
|
Assigning <tt>const char *</tt> 0 to TQCString produces a null TQCString.
|
||
|
<p> The <a href="#length">length</a>() function returns the length of the string; <a href="#resize">resize</a>()
|
||
|
resizes the string and <a href="#truncate">truncate</a>() truncates the string. A string
|
||
|
can be filled with a character using <a href="#fill">fill</a>(). Strings can be left
|
||
|
or right padded with characters using <a href="#leftJustify">leftJustify</a>() and
|
||
|
<a href="#rightJustify">rightJustify</a>(). Characters, strings and regular expressions can be
|
||
|
searched for using <a href="#find">find</a>() and <a href="#findRev">findRev</a>(), and counted using
|
||
|
<a href="#contains">contains</a>().
|
||
|
<p> Strings and characters can be inserted with <a href="#insert">insert</a>() and appended
|
||
|
with <a href="#append">append</a>(). A string can be prepended with <a href="#prepend">prepend</a>().
|
||
|
Characters can be removed from the string with <a href="#remove">remove</a>() and
|
||
|
replaced with <a href="#replace">replace</a>().
|
||
|
<p> Portions of a string can be extracted using <a href="#left">left</a>(), <a href="#right">right</a>() and
|
||
|
<a href="#mid">mid</a>(). Whitespace can be removed using <a href="#stripWhiteSpace">stripWhiteSpace</a>() and
|
||
|
<a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>(). Strings can be converted to uppercase or
|
||
|
lowercase with <a href="#upper">upper</a>() and <a href="#lower">lower</a>() respectively.
|
||
|
<p> Strings that contain numbers can be converted to numbers with
|
||
|
<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>().
|
||
|
Numbers can be converted to strings with <a href="#setNum">setNum</a>().
|
||
|
<p> Many operators are overloaded to work with TQCStrings. TQCString
|
||
|
also supports some more obscure functions, e.g. <a href="#sprintf">sprintf</a>(),
|
||
|
<a href="#setStr">setStr</a>() and <a href="#setExpand">setExpand</a>().
|
||
|
<p> <a name="asciinotion"></a>
|
||
|
<blockquote><p align="center"><b> Note on Character Comparisons
|
||
|
</b>
|
||
|
<p><p> In TQCString the notion of uppercase and lowercase and of which
|
||
|
character is greater than or less than another character is locale
|
||
|
dependent. This affects functions which support a case insensitive
|
||
|
option or which compare or lowercase or uppercase their arguments.
|
||
|
Case insensitive operations and comparisons will be accurate if
|
||
|
both strings contain only ASCII characters. (If <tt>$LC_CTYPE</tt> is
|
||
|
set, most Unix systems do "the right thing".) Functions that this
|
||
|
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
|
||
|
<a href="#upper">upper</a>().
|
||
6 months ago
|
<p> This issue does not apply to <a href="tqstring.html">TQString</a>s since they represent
|
||
13 years ago
|
characters using Unicode.
|
||
|
</blockquote>
|
||
|
<p>
|
||
5 months ago
|
<p> Performance note: The TQCString methods for <a href="tqregexp.html">TQRegExp</a> searching are
|
||
6 months ago
|
implemented by converting the TQCString to a <a href="tqstring.html">TQString</a> and performing
|
||
13 years ago
|
the search on that. This implies a <a href="shclass.html#deep-copy">deep copy</a> of the TQCString data.
|
||
|
If you are going to perform many TQRegExp searches on a large
|
||
|
TQCString, you will get better performance by converting the
|
||
|
TQCString to a TQString yourself, and then searching in the TQString.
|
||
|
<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>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="TQCString"></a>TQCString::TQCString ()
|
||
|
</h3>
|
||
|
|
||
|
<p> Constructs a null string.
|
||
|
<p> <p>See also <a href="#isNull">isNull</a>().
|
||
|
|
||
|
<h3 class=fn><a name="TQCString-2"></a>TQCString::TQCString ( int size )
|
||
|
</h3>
|
||
|
Constructs a string with room for <em>size</em> characters, including
|
||
|
the '\0'-terminator. Makes a null string if <em>size</em> == 0.
|
||
|
<p> If <em>size</em> > 0, then the first and last characters in the string
|
||
|
are initialized to '\0'. All other characters are uninitialized.
|
||
|
<p> <p>See also <a href="#resize">resize</a>() and <a href="#isNull">isNull</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a name="TQCString-3"></a>TQCString::TQCString ( const <a href="tqcstring.html">TQCString</a> & s )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Constructs a <a href="shclass.html#shallow-copy">shallow copy</a> <em>s</em>.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#assign">assign</a>().
|
||
13 years ago
|
|
||
|
<h3 class=fn><a name="TQCString-4"></a>TQCString::TQCString ( const char * str )
|
||
|
</h3>
|
||
|
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>.
|
||
|
<p> If <em>str</em> is 0 a null string is created.
|
||
|
<p> <p>See also <a href="#isNull">isNull</a>().
|
||
|
|
||
|
<h3 class=fn><a name="TQCString-5"></a>TQCString::TQCString ( const char * str, uint maxsize )
|
||
|
</h3>
|
||
|
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>. The copy will
|
||
|
be at most <em>maxsize</em> bytes long including the '\0'-terminator.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString str( "helloworld", 6 ); // assigns "hello" to str
|
||
|
</pre>
|
||
|
|
||
|
<p> If <em>str</em> contains a 0 byte within the first <em>maxsize</em> bytes, the
|
||
|
resulting TQCString will be terminated by this 0. If <em>str</em> is 0 a
|
||
|
null string is created.
|
||
|
<p> <p>See also <a href="#isNull">isNull</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="append"></a>TQCString::append ( const char * str )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Appends string <em>str</em> to the string and returns a reference to the
|
||
|
string. Equivalent to <a href="#operator+-eq">operator+=</a>().
|
||
|
|
||
|
<h3 class=fn>int <a name="contains"></a>TQCString::contains ( char c, bool cs = TRUE ) const
|
||
|
</h3>
|
||
|
Returns the number of times the character <em>c</em> occurs in the
|
||
|
string.
|
||
|
<p> The match is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
||
|
if <em>cs</em> if FALSE.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
|
<h3 class=fn>int <a name="contains-2"></a>TQCString::contains ( const char * str, bool cs = TRUE ) const
|
||
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Returns the number of times <em>str</em> occurs in the string.
|
||
|
<p> The match is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
||
|
if <em>cs</em> if FALSE.
|
||
|
<p> This function counts overlapping substrings, for example, "banana"
|
||
|
contains two occurrences of "ana".
|
||
|
<p> <p>See also <a href="#findRev">findRev</a>() and <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>int <a name="contains-3"></a>TQCString::contains ( const <a href="tqregexp.html">TQRegExp</a> & rx ) const
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Counts the number of overlapping occurrences of <em>rx</em> in the string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
6 months ago
|
<a href="tqstring.html">TQString</a> s = "banana and panama";
|
||
5 months ago
|
<a href="tqregexp.html">TQRegExp</a> r = TQRegExp( "a[nm]a", TRUE, FALSE );
|
||
6 months ago
|
s.<a href="tqstring.html#contains">contains</a>( r ); // 4 matches
|
||
13 years ago
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#find">find</a>() and <a href="#findRev">findRev</a>().
|
||
|
|
||
|
<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
|
||
6 months ago
|
string it is more efficient to convert the string to a <a href="tqstring.html">TQString</a> and
|
||
13 years ago
|
apply the function to that.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="copy"></a>TQCString::copy () const
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Returns a <a href="shclass.html#deep-copy">deep copy</a> of this string.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#detach">detach</a>().
|
||
13 years ago
|
|
||
|
<h3 class=fn>bool <a name="fill"></a>TQCString::fill ( char c, int len = -1 )
|
||
|
</h3>
|
||
|
Fills the string with <em>len</em> bytes of character <em>c</em>, followed by
|
||
|
a '\0'-terminator.
|
||
|
<p> If <em>len</em> is negative, then the current string length is used.
|
||
|
<p> Returns FALSE is <em>len</em> is nonnegative and there is not enough
|
||
|
memory to resize the string; otherwise returns TRUE.
|
||
|
|
||
|
<h3 class=fn>int <a name="find"></a>TQCString::find ( char c, int index = 0, bool cs = TRUE ) const
|
||
|
</h3>
|
||
|
Finds the first occurrence of the character <em>c</em>, starting at
|
||
|
position <em>index</em>.
|
||
|
<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
||
|
if <em>cs</em> is FALSE.
|
||
|
<p> Returns the position of <em>c</em>, or -1 if <em>c</em> could not be found.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x663">network/networkprotocol/nntp.cpp</a>.
|
||
|
<h3 class=fn>int <a name="find-2"></a>TQCString::find ( const char * str, int index = 0, bool cs = TRUE ) const
|
||
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Finds the first occurrence of the string <em>str</em>, starting at
|
||
|
position <em>index</em>.
|
||
|
<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
||
|
if <em>cs</em> is FALSE.
|
||
|
<p> Returns the position of <em>str</em>, or -1 if <em>str</em> could not be
|
||
|
found.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>int <a name="find-3"></a>TQCString::find ( const <a href="tqregexp.html">TQRegExp</a> & rx, int index = 0 ) const
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
5 months ago
|
<p> Finds the first occurrence of the <a href="tqregexp.html#regular-expression">regular expression</a> <em>rx</em>,
|
||
13 years ago
|
starting at position <em>index</em>.
|
||
|
<p> Returns the position of the next match, or -1 if <em>rx</em> was not
|
||
|
found.
|
||
|
<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
|
||
6 months ago
|
string it is more efficient to convert the string to a <a href="tqstring.html">TQString</a> and
|
||
13 years ago
|
apply the function to that.
|
||
|
|
||
|
<h3 class=fn>int <a name="findRev"></a>TQCString::findRev ( char c, int index = -1, bool cs = TRUE ) const
|
||
|
</h3>
|
||
|
Finds the first occurrence of the character <em>c</em>, starting at
|
||
|
position <em>index</em> and searching backwards.
|
||
|
<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
||
|
if <em>cs</em> is FALSE.
|
||
|
<p> Returns the position of <em>c</em>, or -1 if <em>c</em> could not be found.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
|
<h3 class=fn>int <a name="findRev-2"></a>TQCString::findRev ( const char * str, int index = -1, bool cs = TRUE ) const
|
||
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Finds the first occurrence of the string <em>str</em>, starting at
|
||
|
position <em>index</em> and searching backwards.
|
||
|
<p> The search is case sensitive if <em>cs</em> is TRUE, or case insensitive
|
||
|
if <em>cs</em> is FALSE.
|
||
|
<p> Returns the position of <em>str</em>, or -1 if <em>str</em> could not be
|
||
|
found.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>int <a name="findRev-3"></a>TQCString::findRev ( const <a href="tqregexp.html">TQRegExp</a> & rx, int index = -1 ) const
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
5 months ago
|
<p> Finds the first occurrence of the <a href="tqregexp.html#regular-expression">regular expression</a> <em>rx</em>,
|
||
13 years ago
|
starting at position <em>index</em> and searching backwards.
|
||
|
<p> Returns the position of the next match (backwards), or -1 if <em>rx</em>
|
||
|
was not found.
|
||
|
<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
|
||
6 months ago
|
string it is more efficient to convert the string to a <a href="tqstring.html">TQString</a> and
|
||
13 years ago
|
apply the function to that.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="insert"></a>TQCString::insert ( uint index, char c )
|
||
13 years ago
|
</h3>
|
||
|
Inserts character <em>c</em> into the string at position <em>index</em> and
|
||
|
returns a reference to the string.
|
||
|
<p> If <em>index</em> is beyond the end of the string, the string is
|
||
|
padded with spaces (ASCII 32) to length <em>index</em> and then <em>c</em>
|
||
|
is appended.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "Yes";
|
||
|
s.<a href="#insert">insert</a>( 3, '!'); // s == "Yes!"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#remove">remove</a>() and <a href="#replace">replace</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="insert-2"></a>TQCString::insert ( uint index, const char * s )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Inserts string <em>s</em> into the string at position <em>index</em>.
|
||
|
<p> If <em>index</em> is beyond the end of the string, the string is
|
||
|
padded with spaces (ASCII 32) to length <em>index</em> and then <em>s</em>
|
||
|
is appended.
|
||
|
<p> <pre>
|
||
|
TQCString s = "I like fish";
|
||
|
s.<a href="#insert">insert</a>( 2, "don't "); // s == "I don't like fish"
|
||
|
|
||
|
s = "x"; // index 01234
|
||
|
s.<a href="#insert">insert</a>( 3, "yz" ); // s == "x yz"
|
||
|
</pre>
|
||
|
|
||
|
|
||
|
<h3 class=fn>bool <a name="isEmpty"></a>TQCString::isEmpty () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns TRUE if the string is empty, i.e. if <a href="#length">length</a>() == 0;
|
||
|
otherwise returns FALSE. An empty string is not always a null
|
||
|
string.
|
||
|
<p> See example in <a href="#isNull">isNull</a>().
|
||
5 months ago
|
<p> <p>See also <a href="#isNull">isNull</a>(), <a href="#length">length</a>(), and <a href="tqmemarray.html#size">size</a>().
|
||
13 years ago
|
|
||
|
<h3 class=fn>bool <a name="isNull"></a>TQCString::isNull () const
|
||
|
</h3>
|
||
|
|
||
5 months ago
|
<p> Returns TRUE if the string is null, i.e. if <a href="tqmemarray.html#data">data</a>() == 0; otherwise
|
||
13 years ago
|
returns FALSE. A null string is also an empty string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
5 months ago
|
TQCString a; // a.<a href="tqmemarray.html#data">data</a>() == 0, a.<a href="tqmemarray.html#size">size</a>() == 0, a.<a href="#length">length</a>() == 0
|
||
|
TQCString b == ""; // b.<a href="tqmemarray.html#data">data</a>() == "", b.<a href="tqmemarray.html#size">size</a>() == 1, b.<a href="#length">length</a>() == 0
|
||
|
a.<a href="#isNull">isNull</a>(); // TRUE because a.<a href="tqmemarray.html#data">data</a>() == 0
|
||
13 years ago
|
a.<a href="#isEmpty">isEmpty</a>(); // TRUE because a.<a href="#length">length</a>() == 0
|
||
5 months ago
|
b.<a href="#isNull">isNull</a>(); // FALSE because b.<a href="tqmemarray.html#data">data</a>() == ""
|
||
13 years ago
|
b.<a href="#isEmpty">isEmpty</a>(); // TRUE because b.<a href="#length">length</a>() == 0
|
||
|
</pre>
|
||
|
|
||
5 months ago
|
<p> <p>See also <a href="#isEmpty">isEmpty</a>(), <a href="#length">length</a>(), and <a href="tqmemarray.html#size">size</a>().
|
||
13 years ago
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="left"></a>TQCString::left ( uint len ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns a substring that contains the <em>len</em> leftmost characters
|
||
|
of the string.
|
||
|
<p> The whole string is returned if <em>len</em> exceeds the length of the
|
||
|
string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "Pineapple";
|
||
|
TQCString t = s.<a href="#left">left</a>( 4 ); // t == "Pine"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#right">right</a>() and <a href="#mid">mid</a>().
|
||
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x664">network/networkprotocol/nntp.cpp</a>.
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="leftJustify"></a>TQCString::leftJustify ( uint width, char fill = ' ', bool truncate = FALSE ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns a string of length <em>width</em> (plus one for the terminating
|
||
|
'\0') that contains this string padded with the <em>fill</em> character.
|
||
|
<p> If the length of the string exceeds <em>width</em> and <em>truncate</em> is
|
||
|
FALSE (the default), then the returned string is a copy of the
|
||
|
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>).
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s("apple");
|
||
|
TQCString t = s.<a href="#leftJustify">leftJustify</a>(8, '.'); // t == "apple..."
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#rightJustify">rightJustify</a>().
|
||
|
|
||
|
<h3 class=fn>uint <a name="length"></a>TQCString::length () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the length of the string, excluding the '\0'-terminator.
|
||
|
Equivalent to calling <tt>strlen(data())</tt>.
|
||
|
<p> Null strings and empty strings have zero length.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#size">size</a>(), <a href="#isNull">isNull</a>(), and <a href="#isEmpty">isEmpty</a>().
|
||
13 years ago
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x665">network/networkprotocol/nntp.cpp</a>.
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="lower"></a>TQCString::lower () const
|
||
13 years ago
|
</h3>
|
||
|
Returns a new string that is a copy of this string converted to lower
|
||
|
case.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s("Credit");
|
||
|
TQCString t = s.<a href="#lower">lower</a>(); // t == "credit"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#upper">upper</a>() and <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="mid"></a>TQCString::mid ( uint index, uint len = 0xffffffff ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns a substring that contains at most <em>len</em> characters from
|
||
|
this string, starting at position <em>index</em>.
|
||
|
<p> Returns a null string if the string is empty or if <em>index</em> is out
|
||
|
of range. Returns the whole string from <em>index</em> if <em>index+len</em>
|
||
|
exceeds the length of the string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "Two pineapples";
|
||
|
TQCString t = s.<a href="#mid">mid</a>( 4, 3 ); // t == "pin"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#left">left</a>() and <a href="#right">right</a>().
|
||
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x666">network/networkprotocol/nntp.cpp</a>.
|
||
|
<h3 class=fn><a name="operator-const-char-*"></a>TQCString::operator const char * () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the string data.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="operator+-eq"></a>TQCString::operator+= ( const char * str )
|
||
13 years ago
|
</h3>
|
||
|
Appends string <em>str</em> to the string and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="operator+-eq-2"></a>TQCString::operator+= ( char c )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Appends character <em>c</em> to the string and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="operator-eq"></a>TQCString::operator= ( const <a href="tqcstring.html">TQCString</a> & s )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Assigns a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>s</em> to this string and returns a
|
||
|
reference to this string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="operator-eq-2"></a>TQCString::operator= ( const char * str )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em> to this string and returns a
|
||
|
reference to this string.
|
||
|
<p> If <em>str</em> is 0 a null string is created.
|
||
|
<p> <p>See also <a href="#isNull">isNull</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="prepend"></a>TQCString::prepend ( const char * s )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Prepend <em>s</em> to the string. Equivalent to <a href="#insert">insert</a>(0, s).
|
||
|
<p> <p>See also <a href="#insert">insert</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="remove"></a>TQCString::remove ( uint index, uint len )
|
||
13 years ago
|
</h3>
|
||
|
Removes <em>len</em> characters from the string, starting at position <em>index</em>, and returns a reference to the string.
|
||
|
<p> If <em>index</em> is out of range, nothing happens. If <em>index</em> is
|
||
|
valid, but <em>index</em> + <em>len</em> is larger than the length of the
|
||
|
string, the string is truncated at position <em>index</em>.
|
||
|
<p> <pre>
|
||
|
TQCString s = "Montreal";
|
||
|
s.<a href="#remove">remove</a>( 1, 4 ); // s == "Meal"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#insert">insert</a>() and <a href="#replace">replace</a>().
|
||
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x667">network/networkprotocol/nntp.cpp</a>.
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="replace"></a>TQCString::replace ( uint index, uint len, const char * str )
|
||
13 years ago
|
</h3>
|
||
|
Replaces <em>len</em> characters from the string, starting at position
|
||
|
<em>index</em>, with <em>str</em>, and returns a reference to the string.
|
||
|
<p> If <em>index</em> is out of range, nothing is removed and <em>str</em> is
|
||
|
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>
|
||
|
replaces the rest of the string from position <em>index</em>.
|
||
|
<p> <pre>
|
||
|
TQCString s = "Say yes!";
|
||
|
s.<a href="#replace">replace</a>( 4, 3, "NO" ); // s == "Say NO!"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#insert">insert</a>() and <a href="#remove">remove</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="replace-2"></a>TQCString::replace ( const <a href="tqregexp.html">TQRegExp</a> & rx, const char * str )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Replaces every occurrence of <em>rx</em> in the string with <em>str</em>.
|
||
|
Returns a reference to the string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
6 months ago
|
<a href="tqstring.html">TQString</a> s = "banana";
|
||
|
s.<a href="tqstring.html#replace">replace</a>( TQRegExp("a.*a"), "" ); // becomes "b"
|
||
13 years ago
|
|
||
|
s = "banana";
|
||
6 months ago
|
s.<a href="tqstring.html#replace">replace</a>( TQRegExp("^[bn]a"), "X" ); // becomes "Xnana"
|
||
13 years ago
|
|
||
|
s = "banana";
|
||
6 months ago
|
s.<a href="tqstring.html#replace">replace</a>( TQRegExp("^[bn]a"), "" ); // becomes "nana"
|
||
13 years ago
|
</pre>
|
||
|
|
||
|
<p> <b>Warning:</b> If you want to apply this function repeatedly to the same
|
||
6 months ago
|
string it is more efficient to convert the string to a <a href="tqstring.html">TQString</a> and
|
||
13 years ago
|
apply the function to that.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="replace-3"></a>TQCString::replace ( char c, const char * after )
|
||
13 years ago
|
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Replaces every occurrence of the character <em>c</em> in the string
|
||
|
with <em>after</em>. Returns a reference to the string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "a,b,c";
|
||
|
s.<a href="#replace">replace</a>( ',', " or " );
|
||
|
// s == "a or b or c"
|
||
|
</pre>
|
||
|
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="replace-4"></a>TQCString::replace ( const char * before, const char * after )
|
||
13 years ago
|
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Replaces every occurrence of the string <em>before</em> in the string
|
||
|
with the string <em>after</em>. Returns a reference to the string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "Greek is Greek";
|
||
|
s.<a href="#replace">replace</a>( "Greek", "English" );
|
||
|
// s == "English is English"
|
||
|
</pre>
|
||
|
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="replace-5"></a>TQCString::replace ( char c1, char c2 )
|
||
13 years ago
|
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Replaces every occurrence of <em>c1</em> with the char <em>c2</em>.
|
||
|
Returns a reference to the string.
|
||
|
|
||
|
<h3 class=fn>bool <a name="resize"></a>TQCString::resize ( uint len )
|
||
|
</h3>
|
||
|
Extends or shrinks the string to <em>len</em> bytes, including the
|
||
|
'\0'-terminator.
|
||
|
<p> A '\0'-terminator is set at position <tt>len - 1</tt> unless
|
||
|
<tt>len == 0</tt>.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "resize this string";
|
||
|
s.<a href="#resize">resize</a>( 7 ); // s == "resize"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#truncate">truncate</a>().
|
||
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x668">network/networkprotocol/nntp.cpp</a>.
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="right"></a>TQCString::right ( uint len ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns a substring that contains the <em>len</em> rightmost characters
|
||
|
of the string.
|
||
|
<p> The whole string is returned if <em>len</em> exceeds the length of the
|
||
|
string.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "Pineapple";
|
||
|
TQCString t = s.<a href="#right">right</a>( 5 ); // t == "apple"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#left">left</a>() and <a href="#mid">mid</a>().
|
||
|
|
||
|
<p>Example: <a href="networkprotocol-example.html#x669">network/networkprotocol/nntp.cpp</a>.
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="rightJustify"></a>TQCString::rightJustify ( uint width, char fill = ' ', bool truncate = FALSE ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns a string of length <em>width</em> (plus one for the terminating
|
||
|
'\0') that contains zero or more of the <em>fill</em> character followed
|
||
|
by this string.
|
||
|
<p> If the length of the string exceeds <em>width</em> and <em>truncate</em> is
|
||
|
FALSE (the default), then the returned string is a copy of the
|
||
|
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>).
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s("pie");
|
||
|
TQCString t = s.<a href="#rightJustify">rightJustify</a>(8, '.'); // t == ".....pie"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#leftJustify">leftJustify</a>().
|
||
|
|
||
|
<h3 class=fn>bool <a name="setExpand"></a>TQCString::setExpand ( uint index, char c )
|
||
|
</h3>
|
||
|
Sets the character at position <em>index</em> to <em>c</em> and expands the
|
||
|
string if necessary, padding with spaces.
|
||
|
<p> Returns FALSE if <em>index</em> was out of range and the string could
|
||
|
not be expanded; otherwise returns TRUE.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum"></a>TQCString::setNum ( double n, char f = 'g', int prec = 6 )
|
||
13 years ago
|
</h3>
|
||
|
Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
<p> The format of the string representation is specified by the format
|
||
|
character <em>f</em>, and the precision (number of digits after the
|
||
|
decimal point) is specified with <em>prec</em>.
|
||
|
<p> The valid formats for <em>f</em> are 'e', 'E', 'f', 'g' and 'G'. The
|
||
6 months ago
|
formats are the same as for <a href="#sprintf">sprintf</a>(); they are explained in <a href="tqstring.html#arg">TQString::arg</a>().
|
||
13 years ago
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-2"></a>TQCString::setNum ( short n )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-3"></a>TQCString::setNum ( ushort n )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-4"></a>TQCString::setNum ( int n )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-5"></a>TQCString::setNum ( uint n )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-6"></a>TQCString::setNum ( long n )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-7"></a>TQCString::setNum ( ulong n )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the string to the string representation of the number <em>n</em>
|
||
|
and returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setNum-8"></a>TQCString::setNum ( float n, char f = 'g', int prec = 6 )
|
||
13 years ago
|
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="setStr"></a>TQCString::setStr ( const char * str )
|
||
13 years ago
|
</h3>
|
||
|
Makes a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>. Returns a reference to the string.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="simplifyWhiteSpace"></a>TQCString::simplifyWhiteSpace () const
|
||
13 years ago
|
</h3>
|
||
|
Returns a new string that has white space removed from the start
|
||
|
and the end, plus any sequence of internal white space replaced
|
||
|
with a single space (ASCII 32).
|
||
|
<p> White space means the decimal ASCII codes 9, 10, 11, 12, 13 and
|
||
|
32.
|
||
|
<p> <pre>
|
||
|
TQCString s = " lots\t of\nwhite space ";
|
||
|
TQCString t = s.<a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>(); // t == "lots of white space"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#stripWhiteSpace">stripWhiteSpace</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> & <a name="sprintf"></a>TQCString::sprintf ( const char * format, ... )
|
||
13 years ago
|
</h3>
|
||
|
Implemented as a call to the native vsprintf() (see the manual for
|
||
|
your C library).
|
||
|
<p> If the string is shorter than 256 characters, this <a href="#sprintf">sprintf</a>() calls
|
||
|
<a href="#resize">resize</a>(256) to decrease the chance of memory corruption. The
|
||
|
string is resized back to its actual length before sprintf()
|
||
|
returns.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s;
|
||
|
s.<a href="#sprintf">sprintf</a>( "%d - %s", 1, "first" ); // result < 256 chars
|
||
|
|
||
|
TQCString big( 25000 ); // very long string
|
||
|
big.<a href="#sprintf">sprintf</a>( "%d - %s", 2, longString ); // result < 25000 chars
|
||
|
</pre>
|
||
|
|
||
|
<p> <b>Warning:</b> All vsprintf() implementations will write past the end of
|
||
|
the target string (*this) if the <em>format</em> specification and
|
||
|
arguments happen to be longer than the target string, and some
|
||
|
will also fail if the target string is longer than some arbitrary
|
||
|
implementation limit.
|
||
|
<p> Giving user-supplied arguments to sprintf() is risky: Sooner or
|
||
|
later someone will paste a huge line into your application.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="stripWhiteSpace"></a>TQCString::stripWhiteSpace () const
|
||
13 years ago
|
</h3>
|
||
|
Returns a new string that has white space removed from the start
|
||
|
and the end.
|
||
|
<p> White space means the decimal ASCII codes 9, 10, 11, 12, 13 and
|
||
|
32.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = " space ";
|
||
|
TQCString t = s.<a href="#stripWhiteSpace">stripWhiteSpace</a>(); // t == "space"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>().
|
||
|
|
||
|
<h3 class=fn>double <a name="toDouble"></a>TQCString::toDouble ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to a <tt>double</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
||
|
TRUE.
|
||
|
|
||
|
<h3 class=fn>float <a name="toFloat"></a>TQCString::toFloat ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to a <tt>float</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
||
|
TRUE.
|
||
|
|
||
|
<h3 class=fn>int <a name="toInt"></a>TQCString::toInt ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to a <tt>int</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
||
|
TRUE.
|
||
|
|
||
|
<h3 class=fn>long <a name="toLong"></a>TQCString::toLong ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to a <tt>long</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
||
|
TRUE.
|
||
|
|
||
|
<h3 class=fn>short <a name="toShort"></a>TQCString::toShort ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to a <tt>short</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, is out of range, or if it has trailing garbage; otherwise
|
||
|
<em>*ok</em> is set to TRUE.
|
||
|
|
||
|
<h3 class=fn>uint <a name="toUInt"></a>TQCString::toUInt ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to an <tt>unsigned int</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
||
|
TRUE.
|
||
|
|
||
|
<h3 class=fn>ulong <a name="toULong"></a>TQCString::toULong ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to an <tt>unsigned long</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, or if it has trailing garbage; otherwise <em>*ok</em> is set to
|
||
|
TRUE.
|
||
|
|
||
|
<h3 class=fn>ushort <a name="toUShort"></a>TQCString::toUShort ( bool * ok = 0 ) const
|
||
|
</h3>
|
||
|
Returns the string converted to an <tt>unsigned short</tt> value.
|
||
|
<p> If <em>ok</em> is not 0: <em>*ok</em> is set to FALSE if the string is not a
|
||
|
number, is out of range, or if it has trailing garbage; otherwise
|
||
|
<em>*ok</em> is set to TRUE.
|
||
|
|
||
|
<h3 class=fn>bool <a name="truncate"></a>TQCString::truncate ( uint pos )
|
||
|
</h3>
|
||
|
|
||
|
<p> Truncates the string at position <em>pos</em>.
|
||
|
<p> Equivalent to calling <tt>resize(pos+1)</tt>.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s = "truncate this string";
|
||
|
s.<a href="#truncate">truncate</a>( 5 ); // s == "trunc"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#resize">resize</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqcstring.html">TQCString</a> <a name="upper"></a>TQCString::upper () const
|
||
13 years ago
|
</h3>
|
||
|
Returns a new string that is a copy of this string converted to upper case.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
TQCString s( "Debit" );
|
||
|
TQCString t = s.<a href="#upper">upper</a>(); // t == "DEBIT"
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#lower">lower</a>() and <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
|
<hr><h2>Related Functions</h2>
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const <a href="tqcstring.html">TQCString</a> & s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) != 0.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator!-eq-2"></a>operator!= ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) != 0.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator!-eq-3"></a>operator!= ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) != 0.
|
||
|
|
||
5 months ago
|
<h3 class=fn>const <a href="tqcstring.html">TQCString</a> <a name="operator+"></a>operator+ ( const <a href="tqcstring.html">TQCString</a> & s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns a string which consists of the concatenation of <em>s1</em> and
|
||
|
<em>s2</em>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>const <a href="tqcstring.html">TQCString</a> <a name="operator+-2"></a>operator+ ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns a string which consists of the concatenation of <em>s1</em> and <em>s2</em>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>const <a href="tqcstring.html">TQCString</a> <a name="operator+-3"></a>operator+ ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns a string which consists of the concatenation of <em>s1</em> and <em>s2</em>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>const <a href="tqcstring.html">TQCString</a> <a name="operator+-4"></a>operator+ ( const <a href="tqcstring.html">TQCString</a> & s, char c )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns a string which consists of the concatenation of <em>s</em> and <em>c</em>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>const <a href="tqcstring.html">TQCString</a> <a name="operator+-5"></a>operator+ ( char c, const <a href="tqcstring.html">TQCString</a> & s )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns a string which consists of the concatenation of <em>c</em> and <em>s</em>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-lt"></a>operator< ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is less than <em>s2</em>; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) < 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-lt-2"></a>operator< ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is less than <em>s2</em>; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) < 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="ntqdatastream.html">TQDataStream</a> & s, const <a href="tqcstring.html">TQCString</a> & str )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Writes string <em>str</em> to the stream <em>s</em>.
|
||
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-lt-eq"></a>operator<= ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is less than or equal to <em>s2</em>; otherwise
|
||
|
returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) <= 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-lt-eq-2"></a>operator<= ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is less than or equal to <em>s2</em>; otherwise
|
||
|
returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) <= 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const <a href="tqcstring.html">TQCString</a> & s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) == 0.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-eq-eq-2"></a>operator== ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) == 0.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-eq-eq-3"></a>operator== ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) == 0.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-gt"></a>operator> ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is greater than <em>s2</em>; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) > 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-gt-2"></a>operator> ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is greater than <em>s2</em>; otherwise returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) > 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-gt-eq"></a>operator>= ( const <a href="tqcstring.html">TQCString</a> & s1, const char * s2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is greater than or equal to <em>s2</em>; otherwise
|
||
|
returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) >= 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-gt-eq-2"></a>operator>= ( const char * s1, const <a href="tqcstring.html">TQCString</a> & s2 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p>
|
||
|
<p> Returns TRUE if <em>s1</em> is greater than or equal to <em>s2</em>; otherwise
|
||
|
returns FALSE.
|
||
|
<p> Equivalent to <a href="#qstrcmp">qstrcmp</a>(<em>s1</em>, <em>s2</em>) >= 0.
|
||
|
<p> <p>See also <a href="#asciinotion">Note on character comparisons</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="ntqdatastream.html">TQDataStream</a> & s, <a href="tqcstring.html">TQCString</a> & str )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Reads a string into <em>str</em> from the stream <em>s</em>.
|
||
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
||
|
|
||
12 years ago
|
<h3 class=fn>void * <a name="qmemmove"></a>tqmemmove ( void * dst, const void * src, uint len )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This function is normally part of the C library. TQt implements
|
||
|
memmove() for platforms that do not provide it.
|
||
|
<p> memmove() copies <em>len</em> bytes from <em>src</em> into <em>dst</em>. The data
|
||
|
is copied correctly even if <em>src</em> and <em>dst</em> overlap.
|
||
|
|
||
|
<h3 class=fn>int <a name="qstrcmp"></a>qstrcmp ( const char * str1, const char * str2 )
|
||
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> A safe strcmp() function.
|
||
|
<p> Compares <em>str1</em> and <em>str2</em>. 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 than <em>str2</em>.
|
||
|
<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
|
||
|
<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
|
||
|
or <em>str2</em> is 0 (but not both).
|
||
12 years ago
|
<p> <p>See also <a href="#qstrncmp">tqstrncmp</a>(), <a href="#qstricmp">tqstricmp</a>(), <a href="#qstrnicmp">tqstrnicmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
|
||
13 years ago
|
|
||
|
<h3 class=fn>char * <a name="qstrcpy"></a>qstrcpy ( char * dst, const char * src )
|
||
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> A safe strcpy() function.
|
||
|
<p> Copies all characters up to and including the '\0' from <em>src</em>
|
||
|
into <em>dst</em> and returns a pointer to <em>dst</em>.
|
||
|
|
||
12 years ago
|
<h3 class=fn>char * <a name="qstrdup"></a>tqstrdup ( const char * src )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Returns a duplicate string.
|
||
|
<p> Allocates space for a copy of <em>src</em>, copies it, and returns a
|
||
|
pointer to the copy. If <em>src</em> is 0, it immediately returns 0.
|
||
|
<p> The returned string must be deleted using <tt>delete[]</tt>.
|
||
|
|
||
12 years ago
|
<h3 class=fn>int <a name="qstricmp"></a>tqstricmp ( const char * str1, const char * str2 )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> A safe stricmp() function.
|
||
|
<p> Compares <em>str1</em> and <em>str2</em> ignoring the case.
|
||
|
<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
|
||
|
than <em>str2</em>.
|
||
|
<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
|
||
|
<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
|
||
|
or <em>str2</em> is 0 (but not both).
|
||
12 years ago
|
<p> <p>See also <a href="#qstrcmp">qstrcmp</a>(), <a href="#qstrncmp">tqstrncmp</a>(), <a href="#qstrnicmp">tqstrnicmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
|
||
13 years ago
|
|
||
12 years ago
|
<h3 class=fn>uint <a name="qstrlen"></a>tqstrlen ( const char * str )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> A safe strlen function.
|
||
|
<p> Returns the number of characters that precede the terminating '\0'.
|
||
|
or 0 if <em>str</em> is 0.
|
||
|
|
||
12 years ago
|
<h3 class=fn>int <a name="qstrncmp"></a>tqstrncmp ( const char * str1, const char * str2, uint len )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p>
|
||
|
<p> A safe strncmp() function.
|
||
|
<p> Compares at most <em>len</em> bytes of <em>str1</em> and <em>str2</em>.
|
||
|
<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
|
||
|
than <em>str2</em>.
|
||
|
<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
|
||
|
<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
|
||
|
or <em>str2</em> is 0 (but not both).
|
||
12 years ago
|
<p> <p>See also <a href="#qstrcmp">qstrcmp</a>(), <a href="#qstricmp">tqstricmp</a>(), <a href="#qstrnicmp">tqstrnicmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
|
||
13 years ago
|
|
||
12 years ago
|
<h3 class=fn>char * <a name="qstrncpy"></a>tqstrncpy ( char * dst, const char * src, uint len )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> A safe strncpy() function.
|
||
|
<p> Copies at most <em>len</em> bytes from <em>src</em> (stopping at <em>len</em> or the
|
||
|
terminating '\0' whichever comes first) into <em>dst</em> and returns a
|
||
|
pointer to <em>dst</em>. Guarantees that <em>dst</em> is '\0'-terminated. If
|
||
|
<em>src</em> or <em>dst</em> is 0, returns 0 immediately.
|
||
|
<p> <p>See also <a href="#qstrcpy">qstrcpy</a>().
|
||
|
|
||
12 years ago
|
<h3 class=fn>int <a name="qstrnicmp"></a>tqstrnicmp ( const char * str1, const char * str2, uint len )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> A safe strnicmp() function.
|
||
|
<p> Compares at most <em>len</em> bytes of <em>str1</em> and <em>str2</em> ignoring the case.
|
||
|
<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 than <em>str2</em>.
|
||
|
<p> Special case I: Returns 0 if <em>str1</em> and <em>str2</em> are both 0.
|
||
|
<p> Special case II: Returns a random nonzero value if <em>str1</em> is 0
|
||
|
or <em>str2</em> is 0 (but not both).
|
||
12 years ago
|
<p> <p>See also <a href="#qstrcmp">qstrcmp</a>(), <a href="#qstrncmp">tqstrncmp</a>(), <a href="#qstricmp">tqstricmp</a>(), and <a href="#asciinotion">Note on character comparisons</a>.
|
||
13 years ago
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|