Compatibility Members for QString

The following members of class QStringare part of the Qt compatibility layer. We advise against using them in new code.

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.

Warning: This function is not reentrant.

See also setAscii().

QChar QString::constref(uint i) const

Use at() instead.

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

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

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

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

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

Use indexOf() instead.

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

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

Use lastIndexOf() instead.

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

Use lastIndexOf() instead.

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

Use fromUtf16() instead.

const char * QString::latin1() const

Use toLatin1() instead.

Warning: This function is not reentrant.

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.

Warning: This function is not reentrant.

QString QString::lower() const

Use toLower() instead.

QChar & QString::ref(uint i)

Use operator[]() instead.

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

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

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

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

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

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

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

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

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

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

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

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

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.

Warning: This function is not reentrant.

QString::operator const char *() const

Use toAscii().constData() instead.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.