Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions

Qt 3 Support Members for QString

The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

Public Functions

Static Public Members


Member Function Documentation

const char * QString::ascii () const

Returns an 8-bit ASCII representation of the string as a const char *.

If a codec has been set using QTextCodec::setCodecForCStrings(), it is used to convert Unicode to 8-bit char; otherwise this function does the same as latin1().

The result remains valid as long as one unmodified copy of the source string exists and no other 8-bit representations of the same string are requested.

See also fromAscii(), latin1(), utf8(), local8Bit(), and QTextCodec.

QChar QString::constref ( uint i ) const

Use at() instead.

bool QString::contains ( QChar c, bool cs ) const

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

Use the contains(QChar, Qt::CaseSensitive) overload instead.

bool QString::contains ( const QString & s, bool cs ) const

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

Use the contains(QString, Qt::CaseSensitive) overload instead.

QString QString::copy () const

Use simple assignment instead. QString is implicitly shared so if a copy is modified only the copy is changed.

bool QString::endsWith ( const QString & s, bool cs ) const

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

Use the endsWith(QString, Qt::CaseSensitive) overload instead.

int QString::find ( QChar c, int i = 0, bool cs = true ) const

Use indexOf() instead.

int QString::find ( const QString & s, int i = 0, bool cs = true ) const

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

Use indexOf() instead.

int QString::find ( const QRegExp & rx, int i = 0 ) const

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

Use indexOf() instead.

int QString::findRev ( QChar c, int i = -1, bool cs = true ) const

Use lastIndexOf() instead.

int QString::findRev ( const QString & s, int i = -1, bool cs = true ) const

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

Use lastIndexOf() instead.

int QString::findRev ( const QRegExp & rx, int i = -1 ) const

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

Use lastIndexOf() instead.

QString QString::fromUcs2 ( const ushort * unicode, int size = -1 )   [static]

Use fromUtf16() instead.

const char * QString::latin1 () const

Returns a Latin-1 representation of the string as a const char *. The returned string is undefined if the string contains non-Latin1 characters.

The result remains valid as long as one unmodified copy of the source string exists and no other 8-bit representations of the same string are requested.

See also fromLatin1(), ascii(), utf8(), local8Bit(), and QTextCodec.

QString QString::leftJustify ( int width, QChar fill = QLatin1Char( ' ' ), bool trunc = false ) const

Use leftJustified() instead.

QByteArray QString::local8Bit () const

Returns the local 8-bit representation of the string as a const char *. The returned string is undefined if the string contains characters not supported by the local 8-bit encoding.

QTextCodec::codecForLocale() is used to perform the conversion from Unicode.

The result remains valid as long as one unmodified copy of the source string exists and no other 8-bit representations of the same string are requested.

See also fromLocal8Bit(), ascii(), latin1(), utf8(), and QTextCodec.

QString QString::lower () const

Use toLower() instead.

QChar & QString::ref ( uint i )

###

QString & QString::remove ( QChar c, bool cs )

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

Use the remove(QChar, Qt::CaseSensitive) overload instead.

QString & QString::remove ( const QString & s, bool cs )

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

Use the remove(QString, Qt::CaseSensitive) overload instead.

QString & QString::replace ( QChar c, const QString & after, bool cs )

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

Use the replace(QChar, QString, Qt::CaseSensitive) overload instead.

QString & QString::replace ( const QString & before, const QString & after, bool cs )

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

Use the replace(QString, QString, Qt::CaseSensitive) overload instead.

QString & QString::replace ( char c, const QString & after, bool cs )

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

Use the replace(QChar, QString, Qt::CaseSensitive) overload instead.

QString & QString::replace ( char c, const QString & after, Qt::CaseSensitivity cs )

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

Use the replace(QChar, QString, Qt::CaseSensitive) overload instead.

QString QString::rightJustify ( int width, QChar fill = QLatin1Char( ' ' ), bool trunc = false ) const

Use rightJustified() instead.

QString & QString::setAscii ( const char * str, int len = -1 )

Use fromAscii() instead.

QString & QString::setLatin1 ( const char * str, int len = -1 )

Use fromLatin1() instead.

void QString::setLength ( int nl )

Use resize() instead.

QString & QString::setUnicodeCodes ( const ushort * unicode_as_ushorts, int size )

Use setUtf16() instead.

QString QString::simplifyWhiteSpace () const

Use simplified() instead.

bool QString::startsWith ( const QString & s, bool cs ) const

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

Use the startsWith(QString, Qt::CaseSensitive) overload instead.

QString QString::stripWhiteSpace () const

Use trimmed() instead.

const ushort * QString::ucs2 () const

Use utf16() instead.

QString QString::upper () const

Use toUpper() instead.

QByteArray QString::utf8 () const

Returns a UTF-8 representation of the string as a const char *.

The result remains valid as long as one unmodified copy of the source string exists and no other 8-bit representations of the same string are requested.

See also fromUtf8(), ascii(), latin1(), local8Bit(), and QTextCodec.

QString::operator const char * () const

Returns an 8-bit ASCII representation of the string as a const char *.

This operator performs the same as ascii(), except that it is invoked automatically when a QString is used in place of a const char *.

If the QString contains non-ASCII Unicode characters, using this operator can lead to loss of information. You can disable this operator by defining QT_NO_CAST_TO_ASCII when you compile your applications. You then need to call ascii() (or latin1() or utf8() or local8Bit()) explicitly if you want to convert the data to const char *.

See also ascii(), latin1(), utf8(), and local8Bit().


Copyright © 2005 Trolltech Trademarks
Qt 4.0.0-b2