Obsolete Members for QString
The following members of class QString are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
Public Functions
(obsolete) QString | left(qsizetype n) const |
(obsolete) QString | mid(qsizetype position, qsizetype n = -1) const |
(obsolete) QString | right(qsizetype n) const |
Static Public Members
(obsolete) QString | fromUcs4(const uint *str, qsizetype size = -1) |
(obsolete) QString | fromUtf16(const ushort *str, qsizetype size = -1) |
Member Function Documentation
[static]
QString QString::fromUcs4(const uint *str, qsizetype size = -1)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use the char32_t
overload instead.
[static]
QString QString::fromUtf16(const ushort *str, qsizetype size = -1)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use the char16_t
overload.
QString QString::left(qsizetype n) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns a substring that contains the n leftmost characters of the string.
Use first() instead in new code.
The entire string is returned if n is greater than or equal to size(), or less than zero.
QString x = "Pineapple"; QString y = x.left(4); // y == "Pine"
See also first(), last(), startsWith(), chopped(), chop(), and truncate().
QString QString::mid(qsizetype position, qsizetype n = -1) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns a string that contains n characters of this string, starting at the specified position index.
Use sliced() instead in new code.
Returns a null string if the position index exceeds the length of the string. If there are less than n characters available in the string starting at the given position, or if n is -1 (default), the function returns all characters that are available from the specified position.
Example:
QString x = "Nine pineapples"; QString y = x.mid(5, 4); // y == "pine" QString z = x.mid(5); // z == "pineapples"
See also first(), last(), sliced(), chopped(), chop(), and truncate().
QString QString::right(qsizetype n) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns a substring that contains the n rightmost characters of the string.
Use last() instead in new code.
The entire string is returned if n is greater than or equal to size(), or less than zero.
QString x = "Pineapple"; QString y = x.right(5); // y == "apple"
See also endsWith(), last(), first(), sliced(), chopped(), chop(), and truncate().