Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQCString Class Reference

The TQCString class provides an abstraction of the classic C zero-terminated char array (char *). More...

All the functions in this class are reentrant when TQt is built with thread support.

#include <tqcstring.h>

Inherits TQByteArray.

List of all member functions.

Public Members

Related Functions


Detailed Description

The TQCString class provides an abstraction of the classic C zero-terminated char array (char *).

TQCString inherits TQByteArray, which is defined as TQMemArray<char>. Since TQCString is a TQMemArray, it uses explicit sharing with a reference count.

TQCString tries to behave like a more convenient const char *. The price of doing this is that some algorithms will perform badly. For example, append() 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 user-visible text, you should use TQString. TQString provides implicit sharing, Unicode and other internationalization support, and is well optimized.

Note that for the TQCString methods that take a const char * parameter the const char * must either be 0 (null) or not-null and '\0' (NUL byte) terminated; otherwise the results are undefined.

A TQCString that has not been assigned to anything is null, i.e. both the length and the data pointer is 0. A TQCString that references the empty string ("", a single '\0' char) is empty. Both null and empty TQCStrings are legal parameters to the methods. Assigning const char * 0 to TQCString produces a null TQCString.

The length() function returns the length of the string; resize() resizes the string and truncate() truncates the string. A string can be filled with a character using fill(). Strings can be left or right padded with characters using leftJustify() and rightJustify(). Characters, strings and regular expressions can be searched for using find() and findRev(), and counted using contains().

Strings and characters can be inserted with insert() and appended with append(). A string can be prepended with prepend(). Characters can be removed from the string with remove() and replaced with replace().

Portions of a string can be extracted using left(), right() and mid(). Whitespace can be removed using stripWhiteSpace() and simplifyWhiteSpace(). Strings can be converted to uppercase or lowercase with upper() and lower() respectively.

Strings that contain numbers can be converted to numbers with toShort(), toInt(), toLong(), toULong(), toFloat() and toDouble(). Numbers can be converted to strings with setNum().

Many operators are overloaded to work with TQCStrings. TQCString also supports some more obscure functions, e.g. sprintf(), setStr() and setExpand().

Note on Character Comparisons

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 $LC_CTYPE is set, most Unix systems do "the right thing".) Functions that this affects include contains(), find(), findRev(), operator<(), operator<=(), operator>(), operator>=(), lower() and upper().

This issue does not apply to TQStrings since they represent characters using Unicode.

Performance note: The TQCString methods for TQRegExp searching are implemented by converting the TQCString to a TQString and performing the search on that. This implies a deep copy 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.

See also Collection Classes, Implicitly and Explicitly Shared Classes, Text Related Classes, and Non-GUI Classes.


Member Function Documentation

TQCString::TQCString ()

Constructs a null string.

See also isNull().

TQCString::TQCString ( int size )

Constructs a string with room for size characters, including the '\0'-terminator. Makes a null string if size == 0.

If size > 0, then the first and last characters in the string are initialized to '\0'. All other characters are uninitialized.

See also resize() and isNull().

TQCString::TQCString ( const TQCString & s )

Constructs a shallow copy s.

See also assign().

TQCString::TQCString ( const char * str )

Constructs a string that is a deep copy of str.

If str is 0 a null string is created.

See also isNull().

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

Constructs a string that is a deep copy of str. The copy will be at most maxsize bytes long including the '\0'-terminator.

Example:

    TQCString str( "helloworld", 6 ); // assigns "hello" to str
    

If str contains a 0 byte within the first maxsize bytes, the resulting TQCString will be terminated by this 0. If str is 0 a null string is created.

See also isNull().

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

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

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

Returns the number of times the character c occurs in the string.

The match is case sensitive if cs is TRUE, or case insensitive if cs if FALSE.

See also Note on character comparisons.

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

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

Returns the number of times str occurs in the string.

The match is case sensitive if cs is TRUE, or case insensitive if cs if FALSE.

This function counts overlapping substrings, for example, "banana" contains two occurrences of "ana".

See also findRev() and Note on character comparisons.

int TQCString::contains ( const TQRegExp & rx ) const

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

Counts the number of overlapping occurrences of rx in the string.

Example:

    TQString s = "banana and panama";
    TQRegExp r = TQRegExp( "a[nm]a", TRUE, FALSE );
    s.contains( r ); // 4 matches
    

See also find() and findRev().

Warning: If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a TQString and apply the function to that.

TQCString TQCString::copy () const

Returns a deep copy of this string.

See also detach().

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

Fills the string with len bytes of character c, followed by a '\0'-terminator.

If len is negative, then the current string length is used.

Returns FALSE is len is nonnegative and there is not enough memory to resize the string; otherwise returns TRUE.

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

Finds the first occurrence of the character c, starting at position index.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of c, or -1 if c could not be found.

See also Note on character comparisons.

Example: network/networkprotocol/nntp.cpp.

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

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

Finds the first occurrence of the string str, starting at position index.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of str, or -1 if str could not be found.

See also Note on character comparisons.

int TQCString::find ( const TQRegExp & rx, int index = 0 ) const

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

Finds the first occurrence of the regular expression rx, starting at position index.

Returns the position of the next match, or -1 if rx was not found.

Warning: If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a TQString and apply the function to that.

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

Finds the first occurrence of the character c, starting at position index and searching backwards.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of c, or -1 if c could not be found.

See also Note on character comparisons.

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

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

Finds the first occurrence of the string str, starting at position index and searching backwards.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of str, or -1 if str could not be found.

See also Note on character comparisons.

int TQCString::findRev ( const TQRegExp & rx, int index = -1 ) const

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

Finds the first occurrence of the regular expression rx, starting at position index and searching backwards.

Returns the position of the next match (backwards), or -1 if rx was not found.

Warning: If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a TQString and apply the function to that.

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

Inserts character c into the string at position index and returns a reference to the string.

If index is beyond the end of the string, the string is padded with spaces (ASCII 32) to length index and then c is appended.

Example:

    TQCString s = "Yes";
    s.insert( 3, '!');   // s == "Yes!"
    

See also remove() and replace().

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

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

Inserts string s into the string at position index.

If index is beyond the end of the string, the string is padded with spaces (ASCII 32) to length index and then s is appended.

    TQCString s = "I like fish";
    s.insert( 2, "don't ");     // s == "I don't like fish"

    s = "x";                    // index 01234
    s.insert( 3, "yz" );        // s == "x  yz"
    

bool TQCString::isEmpty () const

Returns TRUE if the string is empty, i.e. if length() == 0; otherwise returns FALSE. An empty string is not always a null string.

See example in isNull().

See also isNull(), length(), and size().

bool TQCString::isNull () const

Returns TRUE if the string is null, i.e. if data() == 0; otherwise returns FALSE. A null string is also an empty string.

Example:

    TQCString a;         // a.data() == 0,  a.size() == 0, a.length() == 0
    TQCString b == "";   // b.data() == "", b.size() == 1, b.length() == 0
    a.isNull();         // TRUE  because a.data() == 0
    a.isEmpty();        // TRUE  because a.length() == 0
    b.isNull();         // FALSE because b.data() == ""
    b.isEmpty();        // TRUE  because b.length() == 0
    

See also isEmpty(), length(), and size().

TQCString TQCString::left ( uint len ) const

Returns a substring that contains the len leftmost characters of the string.

The whole string is returned if len exceeds the length of the string.

Example:

    TQCString s = "Pineapple";
    TQCString t = s.left( 4 );  // t == "Pine"
    

See also right() and mid().

Example: network/networkprotocol/nntp.cpp.

TQCString TQCString::leftJustify ( uint width, char fill = ' ', bool truncate = FALSE ) const

Returns a string of length width (plus one for the terminating '\0') that contains this string padded with the fill character.

If the length of the string exceeds width and truncate is FALSE (the default), then the returned string is a copy of the string. If the length of the string exceeds width and truncate is TRUE, then the returned string is a left(width).

Example:

    TQCString s("apple");
    TQCString t = s.leftJustify(8, '.');  // t == "apple..."
    

See also rightJustify().

uint TQCString::length () const

Returns the length of the string, excluding the '\0'-terminator. Equivalent to calling strlen(data()).

Null strings and empty strings have zero length.

See also size(), isNull(), and isEmpty().

Example: network/networkprotocol/nntp.cpp.

TQCString TQCString::lower () const

Returns a new string that is a copy of this string converted to lower case.

Example:

    TQCString s("Credit");
    TQCString t = s.lower();  // t == "credit"
    

See also upper() and Note on character comparisons.

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

Returns a substring that contains at most len characters from this string, starting at position index.

Returns a null string if the string is empty or if index is out of range. Returns the whole string from index if index+len exceeds the length of the string.

Example:

    TQCString s = "Two pineapples";
    TQCString t = s.mid( 4, 3 );     // t == "pin"
    

See also left() and right().

Example: network/networkprotocol/nntp.cpp.

TQCString::operator const char * () const

Returns the string data.

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

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

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

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

Appends character c to the string and returns a reference to the string.

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

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

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

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

Assigns a deep copy of str to this string and returns a reference to this string.

If str is 0 a null string is created.

See also isNull().

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

Prepend s to the string. Equivalent to insert(0, s).

See also insert().

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

Removes len characters from the string, starting at position index, and returns a reference to the string.

If index is out of range, nothing happens. If index is valid, but index + len is larger than the length of the string, the string is truncated at position index.

    TQCString s = "Montreal";
    s.remove( 1, 4 );         // s == "Meal"
    

See also insert() and replace().

Example: network/networkprotocol/nntp.cpp.

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

Replaces len characters from the string, starting at position index, with str, and returns a reference to the string.

If index is out of range, nothing is removed and str is appended at the end of the string. If index is valid, but index + len is larger than the length of the string, str replaces the rest of the string from position index.

    TQCString s = "Say yes!";
    s.replace( 4, 3, "NO" );  // s == "Say NO!"
    

See also insert() and remove().

TQCString & TQCString::replace ( const TQRegExp & rx, const char * str )

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

Replaces every occurrence of rx in the string with str. Returns a reference to the string.

Example:

    TQString s = "banana";
    s.replace( TQRegExp("a.*a"), "" );     // becomes "b"

    s = "banana";
    s.replace( TQRegExp("^[bn]a"), "X" );  // becomes "Xnana"

    s = "banana";
    s.replace( TQRegExp("^[bn]a"), "" );   // becomes "nana"
    

Warning: If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a TQString and apply the function to that.

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

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

Replaces every occurrence of the character c in the string with after. Returns a reference to the string.

Example:

    TQCString s = "a,b,c";
    s.replace( ',', " or " );
    // s == "a or b or c"
    

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

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

Replaces every occurrence of the string before in the string with the string after. Returns a reference to the string.

Example:

    TQCString s = "Greek is Greek";
    s.replace( "Greek", "English" );
    // s == "English is English"
    

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

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

Replaces every occurrence of c1 with the char c2. Returns a reference to the string.

bool TQCString::resize ( uint len )

Extends or shrinks the string to len bytes, including the '\0'-terminator.

A '\0'-terminator is set at position len - 1 unless len == 0.

Example:

    TQCString s = "resize this string";
    s.resize( 7 );                      // s == "resize"
    

See also truncate().

Example: network/networkprotocol/nntp.cpp.

TQCString TQCString::right ( uint len ) const

Returns a substring that contains the len rightmost characters of the string.

The whole string is returned if len exceeds the length of the string.

Example:

    TQCString s = "Pineapple";
    TQCString t = s.right( 5 );  // t == "apple"
    

See also left() and mid().

Example: network/networkprotocol/nntp.cpp.

TQCString TQCString::rightJustify ( uint width, char fill = ' ', bool truncate = FALSE ) const

Returns a string of length width (plus one for the terminating '\0') that contains zero or more of the fill character followed by this string.

If the length of the string exceeds width and truncate is FALSE (the default), then the returned string is a copy of the string. If the length of the string exceeds width and truncate is TRUE, then the returned string is a left(width).

Example:

    TQCString s("pie");
    TQCString t = s.rightJustify(8, '.');  // t == ".....pie"
    

See also leftJustify().

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

Sets the character at position index to c and expands the string if necessary, padding with spaces.

Returns FALSE if index was out of range and the string could not be expanded; otherwise returns TRUE.

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

Sets the string to the string representation of the number n and returns a reference to the string.

The format of the string representation is specified by the format character f, and the precision (number of digits after the decimal point) is specified with prec.

The valid formats for f are 'e', 'E', 'f', 'g' and 'G'. The formats are the same as for sprintf(); they are explained in TQString::arg().

TQCString & TQCString::setNum ( short n )

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

Sets the string to the string representation of the number n and returns a reference to the string.

TQCString & TQCString::setNum ( ushort n )

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

Sets the string to the string representation of the number n and returns a reference to the string.

TQCString & TQCString::setNum ( int n )

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

Sets the string to the string representation of the number n and returns a reference to the string.

TQCString & TQCString::setNum ( uint n )

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

Sets the string to the string representation of the number n and returns a reference to the string.

TQCString & TQCString::setNum ( long n )

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

Sets the string to the string representation of the number n and returns a reference to the string.

TQCString & TQCString::setNum ( ulong n )

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

Sets the string to the string representation of the number n and returns a reference to the string.

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

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

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

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

TQCString TQCString::simplifyWhiteSpace () const

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).

White space means the decimal ASCII codes 9, 10, 11, 12, 13 and 32.

    TQCString s = "  lots\t of\nwhite    space ";
    TQCString t = s.simplifyWhiteSpace(); // t == "lots of white space"
    

See also stripWhiteSpace().

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

Implemented as a call to the native vsprintf() (see the manual for your C library).

If the string is shorter than 256 characters, this sprintf() calls resize(256) to decrease the chance of memory corruption. The string is resized back to its actual length before sprintf() returns.

Example:

    TQCString s;
    s.sprintf( "%d - %s", 1, "first" );         // result < 256 chars

    TQCString big( 25000 );                      // very long string
    big.sprintf( "%d - %s", 2, longString );    // result < 25000 chars
    

Warning: All vsprintf() implementations will write past the end of the target string (*this) if the format 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.

Giving user-supplied arguments to sprintf() is risky: Sooner or later someone will paste a huge line into your application.

TQCString TQCString::stripWhiteSpace () const

Returns a new string that has white space removed from the start and the end.

White space means the decimal ASCII codes 9, 10, 11, 12, 13 and 32.

Example:

    TQCString s = " space ";
    TQCString t = s.stripWhiteSpace();           // t == "space"
    

See also simplifyWhiteSpace().

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

Returns the string converted to a double value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to a float value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to a int value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to a long value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to a short value.

If ok is not 0: *ok is set to FALSE if the string is not a number, is out of range, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to an unsigned int value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to an unsigned long value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

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

Returns the string converted to an unsigned short value.

If ok is not 0: *ok is set to FALSE if the string is not a number, is out of range, or if it has trailing garbage; otherwise *ok is set to TRUE.

bool TQCString::truncate ( uint pos )

Truncates the string at position pos.

Equivalent to calling resize(pos+1).

Example:

    TQCString s = "truncate this string";
    s.truncate( 5 );                      // s == "trunc"
    

See also resize().

TQCString TQCString::upper () const

Returns a new string that is a copy of this string converted to upper case.

Example:

    TQCString s( "Debit" );
    TQCString t = s.upper();  // t == "DEBIT"
    

See also lower() and Note on character comparisons.


Related Functions

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

Returns TRUE if s1 and s2 are different; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) != 0.

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

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

Returns TRUE if s1 and s2 are different; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) != 0.

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

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

Returns TRUE if s1 and s2 are different; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) != 0.

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

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

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

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

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

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

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

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

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

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

Returns a string which consists of the concatenation of s and c.

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

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

Returns a string which consists of the concatenation of c and s.

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

Returns TRUE if s1 is less than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) < 0.

See also Note on character comparisons.

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

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

Returns TRUE if s1 is less than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) < 0.

See also Note on character comparisons.

TQDataStream & operator<< ( TQDataStream & s, const TQCString & str )

Writes string str to the stream s.

See also Format of the TQDataStream operators.

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

Returns TRUE if s1 is less than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) <= 0.

See also Note on character comparisons.

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

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

Returns TRUE if s1 is less than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) <= 0.

See also Note on character comparisons.

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

Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) == 0.

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

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

Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) == 0.

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

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

Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) == 0.

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

Returns TRUE if s1 is greater than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) > 0.

See also Note on character comparisons.

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

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

Returns TRUE if s1 is greater than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) > 0.

See also Note on character comparisons.

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

Returns TRUE if s1 is greater than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) >= 0.

See also Note on character comparisons.

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

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

Returns TRUE if s1 is greater than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) >= 0.

See also Note on character comparisons.

TQDataStream & operator>> ( TQDataStream & s, TQCString & str )

Reads a string into str from the stream s.

See also Format of the TQDataStream operators.

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

This function is normally part of the C library. TQt implements memmove() for platforms that do not provide it.

memmove() copies len bytes from src into dst. The data is copied correctly even if src and dst overlap.

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

A safe strcmp() function.

Compares str1 and str2. Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

See also tqstrncmp(), tqstricmp(), tqstrnicmp(), and Note on character comparisons.

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

A safe strcpy() function.

Copies all characters up to and including the '\0' from src into dst and returns a pointer to dst.

char * tqstrdup ( const char * src )

Returns a duplicate string.

Allocates space for a copy of src, copies it, and returns a pointer to the copy. If src is 0, it immediately returns 0.

The returned string must be deleted using delete[].

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

A safe stricmp() function.

Compares str1 and str2 ignoring the case.

Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

See also qstrcmp(), tqstrncmp(), tqstrnicmp(), and Note on character comparisons.

uint tqstrlen ( const char * str )

A safe strlen function.

Returns the number of characters that precede the terminating '\0'. or 0 if str is 0.

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

A safe strncmp() function.

Compares at most len bytes of str1 and str2.

Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

See also qstrcmp(), tqstricmp(), tqstrnicmp(), and Note on character comparisons.

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

A safe strncpy() function.

Copies at most len bytes from src (stopping at len or the terminating '\0' whichever comes first) into dst and returns a pointer to dst. Guarantees that dst is '\0'-terminated. If src or dst is 0, returns 0 immediately.

See also qstrcpy().

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

A safe strnicmp() function.

Compares at most len bytes of str1 and str2 ignoring the case.

Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

See also qstrcmp(), tqstrncmp(), tqstricmp(), and Note on character comparisons.


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8