|  | Home · All Classes · Main Classes · Grouped Classes · Modules · 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.

- QString class reference

### Public Functions

- const char * ascii () const
- QChar constref ( uint i ) const
- bool contains ( QChar c, bool cs ) const
- bool contains ( const QString & s, bool cs ) const
- QString copy () const
- bool endsWith ( const QString & s, bool cs ) const
- int find ( QChar c, int i = 0, bool cs = true ) const
- int find ( const QString & s, int i = 0, bool cs = true ) const
- int find ( const QRegExp & rx, int i = 0 ) const
- int findRev ( QChar c, int i = -1, bool cs = true ) const
- int findRev ( const QString & s, int i = -1, bool cs = true ) const
- int findRev ( const QRegExp & rx, int i = -1 ) const
- const char * latin1 () const
- QString leftJustify ( int width, QChar fill = QLatin1Char( ' ' ), bool trunc = false ) const
- QByteArray local8Bit () const
- QString lower () const
- QChar & ref ( uint i )
- QString & remove ( QChar c, bool cs )
- QString & remove ( const QString & s, bool cs )
- QString & replace ( QChar c, const QString & after, bool cs )
- QString & replace ( const QString & before, const QString & after, bool cs )
- QString & replace ( char c, const QString & after, bool cs )
- QString & replace ( char c, const QString & after, Qt::CaseSensitivity cs )
- QString rightJustify ( int width, QChar fill = QLatin1Char( ' ' ), bool trunc = false ) const
- QString & setAscii ( const char * str, int len = -1 )
- QString & setLatin1 ( const char * str, int len = -1 )
- void setLength ( int nl )
- QString & setUnicodeCodes ( const ushort * unicode_as_ushorts, int size )
- QString simplifyWhiteSpace () const
- bool startsWith ( const QString & s, bool cs ) const
- QString stripWhiteSpace () const
- const ushort * ucs2 () const
- QString upper () const
- QByteArray utf8 () const
- operator const char * () const

### Static Public Members

- QString fromUcs2 ( const ushort * unicode, int size = -1 )

## Member Function Documentation

### const char * QString::ascii () const

Use toAscii() instead.

See also setAscii().

### 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

Use toLatin1() instead.

See also setLatin1().

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

Use leftJustified() instead.

### QByteArray QString::local8Bit () const

Use toLocal8Bit() instead.

### QString QString::lower () const

Use toLower() instead.

### QChar & QString::ref ( uint i )

Use operator[]() instead.

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

See also ascii().

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

Use fromLatin1() instead.

See also latin1().

### void QString::setLength ( int nl )

Use resize() instead.

See also length().

### 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

Use toUtf8() instead.

### QString::operator const char * () const

Use toAscii().constData() instead.