#include </home/clem/local/src/opie/qmake/include/qstring.h>
Inheritance diagram for QString:


Public Types | |
| enum | SectionFlags { SectionDefault = 0x00, SectionSkipEmpty = 0x01, SectionIncludeLeadingSep = 0x02, SectionIncludeTrailingSep = 0x04, SectionCaseInsensitiveSeps = 0x08 } |
Public Member Functions | |
| QString () | |
| QString (QChar) | |
| QString (const QString &) | |
| QString (const QByteArray &) | |
| QString (const QChar *unicode, uint length) | |
| QString (const char *str) | |
| QString (const std::string &) | |
| ~QString () | |
| QString & | operator= (const QString &) |
| QString & | operator= (const char *) |
| QString & | operator= (const std::string &) |
| QString & | operator= (const QCString &) |
| QString & | operator= (QChar c) |
| QString & | operator= (char c) |
| bool | isNull () const |
| bool | isEmpty () const |
| uint | length () const |
| void | truncate (uint pos) |
| QString & | fill (QChar c, int len=-1) |
| QString | copy () const |
| QString | arg (long a, int fieldwidth=0, int base=10) const |
| QString | arg (ulong a, int fieldwidth=0, int base=10) const |
| QString | arg (int a, int fieldwidth=0, int base=10) const |
| QString | arg (uint a, int fieldwidth=0, int base=10) const |
| QString | arg (short a, int fieldwidth=0, int base=10) const |
| QString | arg (ushort a, int fieldwidth=0, int base=10) const |
| QString | arg (char a, int fieldwidth=0) const |
| QString | arg (QChar a, int fieldwidth=0) const |
| QString | arg (const QString &a, int fieldwidth=0) const |
| QString | arg (double a, int fieldwidth=0, char fmt='g', int prec=-1) const |
| QString & | sprintf (const char *format,...) |
| int | find (QChar c, int index=0, bool cs=TRUE) const |
| int | find (char c, int index=0, bool cs=TRUE) const |
| int | find (const QString &str, int index=0, bool cs=TRUE) const |
| int | find (const QRegExp &, int index=0) const |
| int | find (const char *str, int index=0) const |
| int | findRev (QChar c, int index=-1, bool cs=TRUE) const |
| int | findRev (char c, int index=-1, bool cs=TRUE) const |
| int | findRev (const QString &str, int index=-1, bool cs=TRUE) const |
| int | findRev (const QRegExp &, int index=-1) const |
| int | findRev (const char *str, int index=-1) const |
| int | contains (QChar c, bool cs=TRUE) const |
| int | contains (char c, bool cs=TRUE) const |
| int | contains (const char *str, bool cs=TRUE) const |
| int | contains (const QString &str, bool cs=TRUE) const |
| int | contains (const QRegExp &) const |
| QString | section (QChar sep, int start, int end=0xffffffff, int flags=SectionDefault) const |
| QString | section (char sep, int start, int end=0xffffffff, int flags=SectionDefault) const |
| QString | section (const char *in_sep, int start, int end=0xffffffff, int flags=SectionDefault) const |
| QString | section (const QString &in_sep, int start, int end=0xffffffff, int flags=SectionDefault) const |
| QString | section (const QRegExp ®, int start, int end=0xffffffff, int flags=SectionDefault) const |
| QString | left (uint len) const |
| QString | right (uint len) const |
| QString | mid (uint index, uint len=0xffffffff) const |
| QString | leftJustify (uint width, QChar fill=' ', bool trunc=FALSE) const |
| QString | rightJustify (uint width, QChar fill=' ', bool trunc=FALSE) const |
| QString | lower () const |
| QString | upper () const |
| QString | stripWhiteSpace () const |
| QString | simplifyWhiteSpace () const |
| QString & | insert (uint index, const QString &) |
| QString & | insert (uint index, const QChar *, uint len) |
| QString & | insert (uint index, QChar) |
| QString & | insert (uint index, char c) |
| QString & | append (char) |
| QString & | append (QChar) |
| QString & | append (const QString &) |
| QString & | append (const QByteArray &) |
| QString & | append (const char *) |
| QString & | append (const std::string &) |
| QString & | prepend (char) |
| QString & | prepend (QChar) |
| QString & | prepend (const QString &) |
| QString & | prepend (const QByteArray &) |
| QString & | prepend (const char *) |
| QString & | prepend (const std::string &) |
| QString & | remove (uint index, uint len) |
| QString & | remove (QChar c) |
| QString & | remove (char c) |
| QString & | remove (const QString &) |
| QString & | remove (const QRegExp &) |
| QString & | remove (const char *) |
| QString & | replace (uint index, uint len, const QString &) |
| QString & | replace (uint index, uint len, const QChar *, uint clen) |
| QString & | replace (uint index, uint len, QChar) |
| QString & | replace (uint index, uint len, char c) |
| QString & | replace (QChar c, const QString &) |
| QString & | replace (char c, const QString &after) |
| QString & | replace (const QString &, const QString &) |
| QString & | replace (const QRegExp &, const QString &) |
| QString & | replace (QChar, QChar) |
| short | toShort (bool *ok=0, int base=10) const |
| ushort | toUShort (bool *ok=0, int base=10) const |
| int | toInt (bool *ok=0, int base=10) const |
| uint | toUInt (bool *ok=0, int base=10) const |
| long | toLong (bool *ok=0, int base=10) const |
| ulong | toULong (bool *ok=0, int base=10) const |
| float | toFloat (bool *ok=0) const |
| double | toDouble (bool *ok=0) const |
| QString & | setNum (short, int base=10) |
| QString & | setNum (ushort, int base=10) |
| QString & | setNum (int, int base=10) |
| QString & | setNum (uint, int base=10) |
| QString & | setNum (long, int base=10) |
| QString & | setNum (ulong, int base=10) |
| QString & | setNum (float, char f='g', int prec=6) |
| QString & | setNum (double, char f='g', int prec=6) |
| void | setExpand (uint index, QChar c) |
| QString & | operator+= (const QString &str) |
| QString & | operator+= (const QByteArray &str) |
| QString & | operator+= (const char *str) |
| QString & | operator+= (const std::string &) |
| QString & | operator+= (QChar c) |
| QString & | operator+= (char c) |
| QChar | at (uint i) const |
| QChar | operator[] (int i) const |
| QCharRef | at (uint i) |
| QCharRef | operator[] (int i) |
| QChar | constref (uint i) const |
| QChar & | ref (uint i) |
| const QChar * | unicode () const |
| const char * | ascii () const |
| const char * | latin1 () const |
| QCString | utf8 () const |
| QCString | local8Bit () const |
| bool | operator! () const |
| operator const char * () const | |
| operator std::string () const | |
| const unsigned short * | ucs2 () const |
| QString & | setUnicode (const QChar *unicode, uint len) |
| QString & | setUnicodeCodes (const ushort *unicode_as_ushorts, uint len) |
| QString & | setAscii (const char *, int len=-1) |
| QString & | setLatin1 (const char *, int len=-1) |
| int | compare (const QString &s) const |
| int | localeAwareCompare (const QString &s) const |
| void | compose () |
| const char * | data () const |
| bool | startsWith (const QString &) const |
| bool | endsWith (const QString &) const |
| void | setLength (uint newLength) |
| bool | simpleText () const |
| bool | isRightToLeft () const |
Static Public Member Functions | |
| static QString | number (long, int base=10) |
| static QString | number (ulong, int base=10) |
| static QString | number (int, int base=10) |
| static QString | number (uint, int base=10) |
| static QString | number (double, char f='g', int prec=6) |
| static QString | fromAscii (const char *, int len=-1) |
| static QString | fromLatin1 (const char *, int len=-1) |
| static QString | fromUtf8 (const char *, int len=-1) |
| static QString | fromLocal8Bit (const char *, int len=-1) |
| static QString | fromUcs2 (const unsigned short *ucs2) |
| static int | compare (const QString &s1, const QString &s2) |
| static int | localeAwareCompare (const QString &s1, const QString &s2) |
Public Attributes | |
| QT_STATIC_CONST QString | null |
Private Member Functions | |
| QString (int size, bool) | |
| void | deref () |
| void | real_detach () |
| void | subat (uint) |
| bool | findArg (int &pos, int &len) const |
| void | checkSimpleText () const |
| QString (QStringData *dd, bool) | |
| void | detach () |
Static Private Member Functions | |
| static QChar * | latin1ToUnicode (const char *, uint *len, uint maxlen=(uint)-1) |
| static QChar * | latin1ToUnicode (const QByteArray &, uint *len) |
| static char * | unicodeToLatin1 (const QChar *, uint len) |
| static QStringData * | makeSharedNull () |
Private Attributes | |
| QStringData * | d |
Static Private Attributes | |
| static QStringData * | shared_null = 0 |
Friends | |
| class | QConstString |
| class | QTextStream |
| class | QDeepCopy< QString > |
| Q_EXPORT QDataStream & | operator>> (QDataStream &, QString &) |
Related Functions | |
| (Note that these are not member functions.) | |
| bool | operator== (const QString &s1, const QString &s2) |
| bool | operator== (const QString &s1, const char *s2) |
| bool | operator== (const char *s1, const QString &s2) |
| bool | operator!= (const QString &s1, const QString &s2) |
| bool | operator!= (const QString &s1, const char *s2) |
| bool | operator!= (const char *s1, const QString &s2) |
| bool | operator< (const QString &s1, const char *s2) |
| bool | operator< (const char *s1, const QString &s2) |
| bool | operator<= (const QString &s1, const char *s2) |
| bool | operator<= (const char *s1, const QString &s2) |
| bool | operator> (const QString &s1, const char *s2) |
| bool | operator> (const char *s1, const QString &s2) |
| bool | operator>= (const QString &s1, const char *s2) |
| bool | operator>= (const char *s1, const QString &s2) |
| const QString | operator+ (const QString &s1, const QString &s2) |
| const QString | operator+ (const QString &s1, const char *s2) |
| const QString | operator+ (const char *s1, const QString &s2) |
| const QString | operator+ (const QString &s, char c) |
| const QString | operator+ (char c, const QString &s) |
| QDataStream & | operator<< (QDataStream &s, const QString &str) |
QString uses implicit sharing, which makes it very efficient and easy to use.
In all of the QString methods that take {const char *} parameters, the {const char *} is interpreted as a classic C-style ''-terminated ASCII string. It is legal for the {const char *} parameter to be 0. If the {const char *} is not ''-terminated, the results are undefined. Functions that copy classic C strings into a QString will not copy the terminating '' character. The QChar array of the QString (as returned by unicode()) is generally not terminated by a ''. If you need to pass a QString to a function that requires a C ''-terminated string use latin1().
QString::null A QString that has not been assigned to anything is null, i.e. both the length and data pointer is 0. A QString that references the empty string ("", a single '' char) is empty. Both null and empty QStrings are legal parameters to the methods. Assigning {(const char *) 0} to QString gives a null QString. For convenience, QString::null is a null QString. When sorting, empty strings come first, followed by non-empty strings, followed by null strings. We recommend using {if ( !str.isNull() )} to check for a non-null string rather than {if ( !str )}; see operator!() for an explanation.
Note that if you find that you are mixing usage of QCString, QString, and QByteArray, this causes lots of unnecessary copying and might indicate that the true nature of the data you are dealing with is uncertain. If the data is ''-terminated 8-bit data, use QCString; if it is unterminated (i.e. contains ''s) 8-bit data, use QByteArray; if it is text, use QString.
Lists of strings are handled by the QStringList class. You can split a string into a list of strings using QStringList::split(), and join a list of strings into a single string with an optional separator using QStringList::join(). You can obtain a list of strings from a string list that contain a particular substring or that match a particular regex using QStringList::grep().
Note for C programmers
Due to C++'s type system and the fact that QString is implicitly shared, QStrings may be treated like ints or other simple base types. For example:
QString boolToString( bool b ) { QString result; if ( b ) result = "True"; else result = "False"; return result; }
The variable, result, is an auto variable allocated on the stack. When return is called, because we're returning by value, The copy constructor is called and a copy of the string is returned. (No actual copying takes place thanks to the implicit sharing, see below.)
Throughout Qt's source code you will encounter QString usages like this:
The 'copying' of input to output is almost as fast as copying a pointer because behind the scenes copying is achieved by incrementing a reference count. QString (like all Qt's implicitly shared classes) operates on a copy-on-write basis, only copying if an instance is actually changed.
If you wish to create a deep copy of a QString without losing any Unicode information then you should use QDeepCopy.
Definition at line 382 of file qstring.h.
|
|
SectionDefault Empty fields are counted, leading and trailing separators are not included, and the separator is compared case sensitively. SectionSkipEmpty Treat empty fields as if they don't exist, i.e. they are not considered as far as start and end are concerned. SectionIncludeLeadingSep Include the leading separator (if any) in the result string. SectionIncludeTrailingSep Include the trailing separator (if any) in the result string. SectionCaseInsensitiveSeps Compare the separator case-insensitively. Any of the last four values can be OR-ed together to form a flag.
|
|
|
Constructs a null string, i.e. both the length and data pointer are 0.
Definition at line 761 of file qstring.h. References d, and QShared::ref(). Referenced by contains(), copy(), findRev(), fromLatin1(), fromUcs2(), left(), mid(), operator+=(), operator=(), prepend(), replace(), right(), and section(). |
|
|
Constructs a string of length one, containing the character ch. Definition at line 13178 of file qstring.cpp. References d, QT_ALLOC_QCHAR_VEC, and QStringData::unicode. |
|
|
Constructs an implicitly shared copy of s. This is very fast since it only involves incrementing a reference count. Definition at line 13188 of file qstring.cpp. References d, and QShared::ref(). |
|
|
Constructs a string that is a deep copy of ba interpreted as a classic C string. Definition at line 13223 of file qstring.cpp. References QTextCodec::codecForCStrings(), d, fromAscii(), internalLatin1ToUnicode(), and l. |
|
||||||||||||
|
Constructs a string that is a deep copy of the first length characters in the QChar array. If unicode and length are 0, then a null string is created. If only unicode is 0, the string is empty but has length characters of space preallocated: QString expands automatically anyway, but this may speed up some cases a little. We recommend using the plain constructor and setLength() for this purpose since it will result in more readable code.
Definition at line 13252 of file qstring.cpp. References d, makeSharedNull(), QT_ALLOC_QCHAR_VEC, QShared::ref(), and shared_null. |
|
|
Constructs a string that is a deep copy of str, interpreted as a classic C string. If str is 0, then a null string is created.
This is a cast constructor, but it is perfectly safe: converting a Latin1 const char* to QString preserves all the information. You can disable this constructor by defining
Definition at line 13282 of file qstring.cpp. References QTextCodec::codecForCStrings(), d, fromAscii(), internalLatin1ToUnicode(), and l. |
|
|
Constructs a string that is a deep copy of str. This is the same as fromAscii(str). Definition at line 13303 of file qstring.cpp. References QTextCodec::codecForCStrings(), d, fromAscii(), internalLatin1ToUnicode(), and l. |
|
|
Destroys the string and frees the string's data if this is the last reference to the string. Definition at line 767 of file qstring.h. References d, QStringData::deleteSelf(), QShared::deref(), and shared_null. |
|
||||||||||||
|
For internal use only. Private function. Constructs a string with preallocated space for size characters. The string is empty.
Definition at line 13206 of file qstring.cpp. References d, l, QT_ALLOC_QCHAR_VEC, QShared::ref(), and shared_null. |
|
||||||||||||
|
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends str to the string and returns a reference to the result. Equivalent to operator+=(). Definition at line 855 of file qstring.h. References operator+=(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends str to the string and returns a reference to the result. Equivalent to operator+=(). Definition at line 842 of file qstring.h. References operator+=(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends str to the string and returns a reference to the result. Equivalent to operator+=(). Definition at line 839 of file qstring.h. References operator+=(). |
|
|
Appends str to the string and returns a reference to the result.
Equivalent to operator+=(). Definition at line 835 of file qstring.h. References operator+=(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends character ch to the string and returns a reference to the result. Equivalent to operator+=(). Definition at line 846 of file qstring.h. References operator+=(). |
|
|
||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. arg-formats Argument a is formatted according to the fmt format specified, which is 'g' by default and can be any of the following:
Format Meaning With 'e', 'E', and 'f', prec is the number of digits after the decimal point. With 'g' and 'G', prec is the maximum number of significant digits (trailing zeroes are omitted).
double d = 12.34; QString ds = QString( "'E' format, precision 3, gives %1" ) .arg( d, 0, 'E', 3 ); // ds == "1.234E+001" Definition at line 13720 of file qstring.cpp. |
|
||||||||||||
|
This function will return a string that replaces the lowest numbered occurrence of The fieldwidth value specifies the minimum amount of space that a is padded to. A positive value will produce right-aligned text, whereas a negative value will produce left-aligned text. The following example shows how we could create a 'status' string when processing a list of files: QString status = QString( "Processing file %1 of %2: %3" ) .arg( i ) // current file's number .arg( total ) // number of files to process .arg( fileName ); // current file's name It is generally fine to use filenames and numbers as we have done in the example above. But note that using arg() to construct natural language sentences does not usually translate well into other languages because sentence structure and word order often differ between languages.
If there is no place marker ( Definition at line 13564 of file qstring.cpp. References findArg(), insert(), latin1(), length(), pos, qWarning(), replace(), and s. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 13685 of file qstring.cpp. References arg(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. a is assumed to be in the Latin1 character set. Definition at line 13675 of file qstring.cpp. References arg(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. a is expressed in base base, which is 10 by default and must be between 2 and 36. Definition at line 883 of file qstring.h. References arg(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. a is expressed in base base, which is 10 by default and must be between 2 and 36. Definition at line 880 of file qstring.h. References arg(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. a is expressed in base base, which is 10 by default and must be between 2 and 36. Definition at line 877 of file qstring.h. References arg(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. a is expressed in base base, which is 10 by default and must be between 2 and 36. Definition at line 874 of file qstring.h. References arg(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. a is expressed in base base, which is 10 by default and must be between 2 and 36. Definition at line 13628 of file qstring.cpp. |
|
||||||||||||||||
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The function returns a reference to the character at index i. The resulting reference can then be assigned to, or used immediately, but it will become invalid once further modifications are made to the original string. If i is beyond the length of the string then the string is expanded with QChar::null. |
|
|
|
For internal use only.
Definition at line 17196 of file qstring.cpp. References d, end, FALSE, QStringData::issimpletext, QStringData::len, p, TRUE, QChar::unicode(), and QStringData::unicode. |
|
||||||||||||
|
Lexically compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with QString::localeAwareCompare().
int a = QString::compare( "def", "abc" ); // a > 0 int b = QString::compare( "abc", "def" ); // b < 0 int c = QString::compare(" abc", "abc" ); // c == 0 Definition at line 623 of file qstring.h. References compare(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Lexically compares this string with s and returns an integer less than, equal to, or greater than zero if it is less than, equal to, or greater than s. Definition at line 17269 of file qstring.cpp. References ucstrcmp(). Referenced by TVVariant::closer(), compare(), compareAppletPositions(), QStringVector::compareItems(), description(), AccountDisplay::editAccount(), BudgetDisplay::editBudget(), ZSafe::editCategory(), localeAwareCompare(), DateBookSettings::pluginItemClicked(), qt_cmp_si(), ZSafe::showInfo(), EditAccounts::slotNewAccount(), Opie::Internal::summary(), Server::systemMsg(), Opie::Internal::OPimSortVector< T >::testString(), PinPlugin::verify(), TodayConfig::writeConfig(), and XLessThanY(). |
|
|
Definition at line 12836 of file qstring.cpp. References at(), code, QLigature::current(), QChar::Final, QLigature::first(), format(), QLigature::head(), len, length(), QLigature::match(), QLigature::next(), replace(), QLigature::tag(), and QChar::unicode(). |
|
|
Returns the QChar at index i by value. Equivalent to at(i).
Definition at line 587 of file qstring.h. References at(). Referenced by TextLine::getChar(), remove(), QTextStream::ts_getbuf(), and QTextStream::ts_getline(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the number of times the regexp, rx, matches in the string. This function counts overlapping matches, so in the example below, there are four instances of "ana" or "ama".
QString str = "banana and panama"; QRegExp rxp = QRegExp( "a[nm]a", TRUE, FALSE ); int i = str.contains( rxp ); // i == 4
Definition at line 15851 of file qstring.cpp. References length(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the number of times str occurs in the string. If cs is TRUE, the search is case sensitive; otherwise the search is case insensitive. This function counts overlapping strings, so in the example below, there are two instances of "ana" in "bananas".
Definition at line 14794 of file qstring.cpp. References bm_find(), bm_init_skiptable(), i, and isNull(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the number of times the string str occurs in the string. If cs is TRUE, the search is case sensitive; otherwise the search is case insensitive. Definition at line 14741 of file qstring.cpp. References contains(), and QString(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
||||||||||||
|
|
In Qt 2.0 and later, all calls to this function are needless. Just remove them. Definition at line 808 of file qstring.h. References QString(). Referenced by ModemTransfer::readtty(). |
|
|
Returns a pointer to a ''-terminated classic C string. In Qt 1.x, this returned a char* allowing direct manipulation of the string as a sequence of bytes. In Qt 2.x where QString is a Unicode string, char* conversion constructs a temporary string, and hence direct character operations are meaningless. Definition at line 637 of file qstring.h. Referenced by IMAPwrapper::address_list_to_stringlist(), RunningAppBar::applicationLaunched(), Opie::XMLElement::attribute(), Opie::Core::XMLElement::attribute(), Generatemail::buildFilePart(), Generatemail::buildTxtPart(), KpacmanWidget::confScheme(), Painter::fillScoreString(), Board::init(), Referee::introPaint(), AppLauncher::isRunning(), Painter::loadPixmap(), Score::paintEvent(), Opie::OPimContactAccessBackend_VCard::parseVObject(), DateBookDB::saveJournalEntry(), RecPart::searchParamter(), ViewMail::setBody(), Sheet::swapCells(), and Bitfont::text(). |
|
|
Definition at line 13340 of file qstring.cpp. References d, QShared::deref(), and shared_null. Referenced by fill(), operator=(), setLength(), and setUnicode(). |
|
|
If the string does not share its data with another QString instance, nothing happens; otherwise the function creates a new, unique copy of this string. This function is called whenever the map is modified. The implicit sharing mechanism is implemented this way. Definition at line 776 of file qstring.h. References real_detach(). |
|
|
||||||||||||
|
Fills the string with len characters of value c, and returns a reference to the string. If len is negative (the default), the current string length is used.
Definition at line 13950 of file qstring.cpp. References d, deref(), length(), and QT_ALLOC_QCHAR_VEC. Referenced by Wellenreiter::channelHopped(), Status::decodeHexOctString(), Painter::decodeHexOctString(), CalculatorImpl::enterNumber(), Board::init(), KateDocument::optimizeLeadingSpace(), QGDict::statistics(), QGCache::statistics(), and FileBrowser::updateDirMenu(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to find(QString(str), index). Definition at line 893 of file qstring.h. References find(), and fromAscii(). |
|
||||||||||||
|
Finds the first match of the regular expression rx, starting from position index. If index is -1, the search starts at the last character; if -2, at the next to last character and so on. (See findRev() for searching backwards.) Returns the position of the first match of rx or -1 if no match was found.
Definition at line 15805 of file qstring.cpp. References QRegExp::search(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Finds the first occurrence of the string str, starting at position index. If index is -1, the search starts at the last character, if it is -2, at the next to last character and so on. (See findRev() for searching backwards.) If cs is TRUE, the search is case sensitive; otherwise the search is case insensitive. Returns the position of str or -1 if str could not be found. Definition at line 14126 of file qstring.cpp. References bm_find(), bm_init_skiptable(), end, find(), i, l, length(), lower(), REHASH, ucstrncmp(), ucstrnicmp(), QChar::unicode(), and unicode(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Find character c starting from position index. If cs is TRUE, the search is case sensitive; otherwise the search is case insensitive. Definition at line 886 of file qstring.h. References find(). |
|
||||||||||||||||
|
||||||||||||
|
Definition at line 13729 of file qstring.cpp. References d, i, l, length(), and QStringData::unicode. Referenced by arg(). |
|
||||||||||||
|
Equivalent to findRev(QString(str), index). Definition at line 896 of file qstring.h. References findRev(), and fromAscii(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Finds the first match of the regexp rx, starting at position index and searching backwards. If the index is -1, the search starts at the last character, if it is -2, at the next to last character and so on. (See findRev() for searching backwards.) Returns the position of the match or -1 if no match was found.
Definition at line 15828 of file qstring.cpp. |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Finds the first occurrence of the string str, starting at position index and searching backwards. If the index is -1, the search starts at the last character, if it is -2, at the next to last character and so on. Returns the position of str or -1 if str could not be found. If cs is TRUE, the search is case sensitive; otherwise the search is case insensitive.
Definition at line 14277 of file qstring.cpp. References end, findRev(), i, l, length(), lower(), REHASH, ucstrncmp(), ucstrnicmp(), QChar::unicode(), and unicode(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Find character c starting from position index and working backwards. If cs is TRUE, the search is case sensitive; otherwise the search is case insensitive. Definition at line 889 of file qstring.h. References findRev(). |
|
||||||||||||||||
|
||||||||||||
|
Returns the Unicode string decoded from the first len characters of ascii, ignoring the rest of ascii. If len is -1 then the length of ascii is used. If len is bigger than the length of ascii then it will use the length of ascii. If a codec has been set using QTextCodec::codecForCStrings(), it is used to convert Unicode to 8-bit char. Otherwise, this function does the same as fromLatin1().
This is the same as the QString(const char*) constructor, but you can make that constructor invisible if you compile with the define
QString str = QString::fromAscii( "123456789", 5 ); // str == "12345" Definition at line 16788 of file qstring.cpp. References QTextCodec::codecForCStrings(), and fromLatin1(). Referenced by QCString::contains(), QCString::find(), find(), QCString::findRev(), findRev(), operator+(), operator+=(), QString(), QCString::replace(), setAscii(), and sprintf(). |
|
||||||||||||
|
||||||||||||
|
Returns the Unicode string decoded from the first len characters of local8Bit, ignoring the rest of local8Bit. If len is -1 then the length of local8Bit is used. If len is bigger than the length of local8Bit then it will use the length of local8Bit.
QString str = QString::fromLocal8Bit( "123456789", 5 ); // str == "12345" local8Bit is assumed to be encoded in a locale-specific format. See QTextCodec for more diverse coding/decoding of Unicode strings. Definition at line 16885 of file qstring.cpp. References QTextCodec::codecForLocale(), fromLatin1(), fromUtf8(), s, and QTextCodec::toUnicode(). Referenced by SyncAuthentication::checkPassword(), DateEntry::event(), Process::exec(), Picture::load(), MCursor::load(), locale_decoder(), SyncAuthentication::loginName(), QDate::longDayName(), QDate::longMonthName(), Opie::Core::perror(), QCopBridge::sendDesktopMessageOld(), Opie::setTimeZone(), QDate::shortDayName(), QDate::shortMonthName(), OpieObex::Receiver::tidyUp(), QDateTime::toString(), QTime::toString(), and QDate::toString(). |
|
|
Constructs a string that is a deep copy of str, interpreted as a UCS2 encoded, zero terminated, Unicode string. If str is 0, then a null string is created.
Definition at line 16971 of file qstring.cpp. References length(), QString(), QT_ALLOC_QCHAR_VEC, and TRUE. Referenced by QDate::longDayName(), QDate::longMonthName(), QSettingsPrivate::QSettingsPrivate(), QDate::shortDayName(), QDate::shortMonthName(), QLocalePrivate::systemLocaleName(), QDateTime::toString(), QTime::toString(), and QDate::toString(). |
|
||||||||||||
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Insert character c at position index. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Insert 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 extended with spaces (ASCII 32) to length index and c is then appended. Definition at line 15215 of file qstring.cpp. |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Inserts the first len characters in s into the string at position index and returns a reference to the string. Definition at line 15172 of file qstring.cpp. References d, insert(), length(), QStringData::maxl, QT_ALLOC_QCHAR_VEC, QT_DELETE_QCHAR_VEC, setLength(), unicode(), and QStringData::unicode. |
|
||||||||||||
|
|
|
|
For internal use only.
Definition at line 17218 of file qstring.cpp. References d, QChar::DirAL, direction(), QChar::DirL, QChar::DirLRE, QChar::DirLRO, QChar::DirR, QChar::DirRLE, QChar::DirRLO, FALSE, length(), p, TRUE, and QStringData::unicode. |
|
|
||||||||||||
|
This utility function converts the 8-bit string ba to Unicode, returning the result. The caller is responsible for deleting the return value with delete[]. Definition at line 12900 of file qstring.cpp. |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This utility function converts the ''-terminated 8-bit string str to Unicode, returning the result and setting *len to the length of the Unicode string. The caller is responsible for deleting the return value with delete[]. Definition at line 12949 of file qstring.cpp. |
|
|
||||||||||||||||
|
Returns a string of length width that contains this string padded by the fill character. If truncate is FALSE and the length of the string is more than width, then the returned string is a copy of the string. If truncate is TRUE and the length of the string is more than width, then any characters in a copy of the string after length width are removed, and the copy is returned.
QString s( "apple" ); QString t = s.leftJustify( 8, '.' ); // t == "apple..."
Definition at line 14926 of file qstring.cpp. References d, left(), length(), setLength(), unicode(), and QStringData::unicode. Referenced by ServerPI::fileListing(), main(), QTextStream::operator<<(), and sprintf(). |
|
|
|
||||||||||||
|
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2. The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.
Definition at line 627 of file qstring.h. References localeAwareCompare(). |
|
|
Definition at line 17300 of file qstring.cpp. References compare(), isEmpty(), length(), and ucs2(). Referenced by localeAwareCompare(). |
|
|
|
Definition at line 13156 of file qstring.cpp. References d. Referenced by QString(), and setUnicode(). |
|
||||||||||||
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Argument n is formatted according to the f format specified, which is
Format Meaning With 'e', 'E', and 'f', prec is the number of digits after the decimal point. With 'g' and 'G', prec is the maximum number of significant digits (trailing zeroes are omitted).
double d = 12.34; QString ds = QString( "'E' format, precision 3, gives %1" ) .arg( d, 0, 'E', 3 ); // ds == "1.234E+001"
Definition at line 16392 of file qstring.cpp. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A convenience factory function that returns a string representation of the number n to the base base, which is 10 by default and must be between 2 and 36.
Definition at line 16357 of file qstring.cpp. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 16341 of file qstring.cpp. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 16329 of file qstring.cpp. |
|
||||||||||||
|
|
Returns latin1(). Be sure to see the warnings documented in the latin1() function. Note that for new code which you wish to be strictly Unicode-clean, you can define the macro |
|
|
Returns ascii(). Definition at line 611 of file qstring.h. References ascii(). |
|
|
Returns TRUE if this is a null string; otherwise returns FALSE.
QString name = getName(); if ( !name ) name = "Rodney"; Note that if you say
QString name = getName(); if ( name ) doSomethingWith(name);
It will call "operator const char*()", which is inefficent; you may wish to define the macro When you want the above semantics, use:
Definition at line 799 of file qstring.h. References isNull(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends c to the string and returns a reference to the string. Definition at line 16592 of file qstring.cpp. References QTextCodec::codecForCStrings(), d, fromAscii(), length(), operator+=(), setLength(), and QStringData::unicode. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends c to the string and returns a reference to the string. Definition at line 16579 of file qstring.cpp. References d, length(), setLength(), and QStringData::unicode. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends str to the string and returns a reference to the string. Definition at line 853 of file qstring.h. References operator+=(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends str to the string and returns a reference to the string. Definition at line 16549 of file qstring.cpp. References QTextCodec::codecForCStrings(), d, fromAscii(), fromLatin1(), i, isNull(), length(), operator+=(), setLength(), and QStringData::unicode. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends str to the string and returns a reference to the string. Definition at line 831 of file qstring.h. References operator+=(), and QString(). |
|
|
Appends str to the string and returns a reference to the string. Definition at line 16530 of file qstring.cpp. References d, fromLatin1(), isNull(), length(), setLength(), unicode(), and QStringData::unicode. Referenced by append(), and operator+=(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to contain just the single character c. Definition at line 793 of file qstring.h. References QString(). |
|
|
Sets the string to contain just the single character c. Definition at line 790 of file qstring.h. References QString(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Assigns a deep copy of cs, interpreted as a classic C string, to this string and returns a reference to this string. Definition at line 13398 of file qstring.cpp. References setAscii(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Makes a deep copy of s and returns a reference to the deep copy. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Assigns a deep copy of str, interpreted as a classic C string to this string and returns a reference to this string. If str is 0, then a null string is created.
Definition at line 13414 of file qstring.cpp. References setAscii(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Assigns a shallow copy of s to this string and returns a reference to this string. This is very fast because the string isn't actually copied. Definition at line 13384 of file qstring.cpp. References d, deref(), and QShared::ref(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The function returns a reference to the character at index i. The resulting reference can then be assigned to, or used immediately, but it will become invalid once further modifications are made to the original string. If i is beyond the length of the string then the string is expanded with QChar::nulls, so that the QCharRef references a valid (null) character in the string. The QCharRef internal class can be used much like a constant QChar, but if you assign to it, you change the original string (which will detach itself because of QString's copy-on-write semantics). You will get compilation errors if you try to use the result as anything but a QChar. Definition at line 733 of file qstring.h. References at(). |
|
|
Returns the character at index i, or QChar::null if i is beyond the length of the string. If the QString is not const (i.e., const QString) or const& (i.e., const QString&), then the non-const overload of operator[] will be used instead. Definition at line 583 of file qstring.h. References at(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Inserts s at the beginning of the string and returns a reference to the string. Equivalent to insert(0, s).
Definition at line 826 of file qstring.h. References insert(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Inserts s at the beginning of the string and returns a reference to the string. Equivalent to insert(0, s).
Definition at line 15301 of file qstring.cpp. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Inserts s at the beginning of the string and returns a reference to the string. Equivalent to insert(0, s).
|
|
|
Inserts s at the beginning of the string and returns a reference to the string. Equivalent to insert(0, s).
Definition at line 811 of file qstring.h. References insert(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Inserts ch at the beginning of the string and returns a reference to the string. Equivalent to insert(0, ch).
Definition at line 814 of file qstring.h. References insert(). |
|
|
|
Deallocates any space reserved solely by this QString. If the string does not share its data with another QString instance, nothing happens; otherwise the function creates a new, unique copy of this string. This function is called whenever the string is modified. Definition at line 13335 of file qstring.cpp. References length(), and setLength(). Referenced by detach(), lower(), remove(), replace(), subat(), and upper(). |
|
|
Returns the QChar at index i by reference, expanding the string with QChar::null if necessary. The resulting reference can be assigned to, or otherwise used immediately, but becomes invalid once furher modifications are made to the string.
Definition at line 589 of file qstring.h. References d. Referenced by QLocalePrivate::doubleToString(), and LauncherView::setBackgroundType(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes every occurrence of str in the string. Returns a reference to the string. Definition at line 15426 of file qstring.cpp. References fromLatin1(), and remove(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes every occurrence of the regular expression rx in the string. Returns a reference to the string. This is the same as replace(rx, ""). Definition at line 15414 of file qstring.cpp. References replace(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes every occurrence of str in the string. Returns a reference to the string. This is the same as replace(str, ""). Definition at line 15376 of file qstring.cpp. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes every occurrence of the character c in the string. Returns a reference to the string. This is the same as replace(c, ""). Definition at line 522 of file qstring.h. References remove(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes every occurrence of the character c in the string. Returns a reference to the string. This is the same as replace(c, ""). Definition at line 15346 of file qstring.cpp. References constref(), i, length(), and remove(). |
|
||||||||||||
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Replaces every occurrence of c1 with the char c2. Returns a reference to the string. Definition at line 15391 of file qstring.cpp. References d, i, real_detach(), and QStringData::unicode. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Replaces every occurrence of the regexp rx in the string with str. Returns a reference to the string. For example: For regexps containing capturing parentheses , occurrences of \1, \2, ..., in str are replaced with {rx}.cap(1), cap(2), ...
QString t = "A <i>bon mot</i>."; t.replace( QRegExp("<i>([^<]*)</i>"), "\\emph{\\1}" ); // t == "A \\emph{bon mot}."
Definition at line 15652 of file qstring.cpp. References QRegExp::cap(), QRegExp::CaretAtZero, QRegExp::CaretWontMatch, d, QChar::digitValue(), i, isNull(), QStringData::len, length(), QRegExp::matchedLength(), QStringData::maxl, no, QRegExp::numCaptures(), pos, QT_ALLOC_QCHAR_VEC, QT_DELETE_QCHAR_VEC, real_detach(), replace(), QRegExp::search(), QStringData::setDirty(), size, QStringData::unicode, and unicode(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Replaces every occurrence of the string before in the string with the string after. Returns a reference to the string. Example: Definition at line 15535 of file qstring.cpp. References bm_find(), bm_init_skiptable(), d, isNull(), QStringData::len, length(), pos, real_detach(), setLength(), TRUE, QStringData::unicode, and unicode(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Replaces every occurrence of the character c in the string with after. Returns a reference to the string. Definition at line 536 of file qstring.h. References KateCommands::replace(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Replaces every occurrence of the character c in the string with after. Returns a reference to the string. Example: Definition at line 15511 of file qstring.cpp. |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is the same as replace(index, len, QChar(c)). Definition at line 533 of file qstring.h. References KateCommands::replace(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is the same as replace(index, len, QString(c)). Definition at line 15459 of file qstring.cpp. References replace(). |
|
||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Replaces len characters with slen characters of QChar data from s, starting at position index, and returns a reference to the string.
Definition at line 15480 of file qstring.cpp. References d, insert(), length(), QStringData::maxl, QT_ALLOC_QCHAR_VEC, QT_DELETE_QCHAR_VEC, real_detach(), remove(), replace(), and QStringData::unicode. |
|
||||||||||||||||
|
|
||||||||||||||||
|
||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function returns a section of the string. This string is treated as a sequence of fields separated by the regular expression, reg. The returned string consists of the fields from position start to position end inclusive. If end is not specified, all fields from position start to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left. The flags argument can be used to affect some aspects of the function's behaviour, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see {SectionFlags}.
QString line( "forename\tmiddlename surname \t \t phone" ); QRegExp sep( "\s+" ); QString s = line.section( sep, 2, 2 ); // s == "surname" If start or end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.
QString line( "forename\tmiddlename surname \t \t phone" ); QRegExp sep( "\\s+" ); QString s = line.section( sep, -3, -2 ); // s == "middlename surname"
Definition at line 14630 of file qstring.cpp. References QPtrList< type >::append(), QPtrList< type >::count(), QPtrList< type >::first(), i, l, left(), length(), QRegExp::matchedLength(), mid(), QPtrList< type >::next(), QString(), QRegExp::search(), SectionCaseInsensitiveSeps, SectionIncludeLeadingSep, SectionIncludeTrailingSep, SectionSkipEmpty, QPtrCollection::setAutoDelete(), QRegExp::setCaseSensitive(), TRUE, and unicode(). |
|
||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function returns a section of the string. This string is treated as a sequence of fields separated by the string, sep. The returned string consists of the fields from position start to position end inclusive. If end is not specified, all fields from position start to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left. The flags argument can be used to affect some aspects of the function's behaviour, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see {SectionFlags}.
QString data( "forename**middlename**surname**phone" ); QString s = data.section( "**", 2, 2 ); // s == "surname" If start or end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.
QString data( "forename**middlename**surname**phone" ); QString s = data.section( "**", -3, -2 ); // s == "middlename**surname"
Definition at line 14443 of file qstring.cpp. References begin, FALSE, length(), lower(), match(), QString(), SectionCaseInsensitiveSeps, SectionIncludeLeadingSep, SectionIncludeTrailingSep, SectionSkipEmpty, TRUE, and unicode(). |
|
||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 782 of file qstring.h. References section(). |
|
||||||||||||||||||||
|
This function returns a section of the string. This string is treated as a sequence of fields separated by the character, sep. The returned string consists of the fields from position start to position end inclusive. If end is not specified, all fields from position start to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left. The flags argument can be used to affect some aspects of the function's behaviour, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see {SectionFlags}.
QString csv( "forename,middlename,surname,phone" ); QString s = csv.section( ',', 2, 2 ); // s == "surname" QString path( "/usr/local/bin/myapp" ); // First field is empty QString s = path.section( '/', 3, 4 ); // s == "bin/myapp" QString s = path.section( '/', 3, 3, SectionSkipEmpty ); // s == "myapp" If start or end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.
QString csv( "forename,middlename,surname,phone" ); QString s = csv.section( ',', -3, -2 ); // s == "middlename,surname" QString path( "/usr/local/bin/myapp" ); // First field is empty QString s = path.section( '/', -1 ); // s == "myapp"
Definition at line 779 of file qstring.h. References QString(). Referenced by VCFilter::addUICstage(), DspMakefileGenerator::beginGroupForFile(), MakefileGenerator::generateDependencies(), ProjectBuilderMakefileGenerator::openOutput(), section(), UnixMakefileGenerator::writeMakeParts(), NmakeMakefileGenerator::writeNmakeParts(), VcprojGenerator::writeSubDirs(), UnixMakefileGenerator::writeSubdirs(), and MakefileGenerator::writeUicSrc(). |
|
||||||||||||
|
Sets this string to str, interpreted as a classic 8-bit ASCII C string. If len is -1 (the default), then it is set to strlen(str). If str is 0 a null string is created. If str is "", an empty string is created.
Definition at line 17155 of file qstring.cpp. References QTextCodec::codecForCStrings(), fromAscii(), and setLatin1(). Referenced by operator=(). |
|
||||||||||||
|
Sets the character at position index to c and expands the string if necessary, filling with spaces. This method is redundant in Qt 3.x, because operator[] will expand the string as necessary. Definition at line 16409 of file qstring.cpp. References at(), d, QStringData::len, and QStringData::unicode. Referenced by Score::Score(). |
|
||||||||||||
|
Sets this string to str, interpreted as a classic Latin1 C string. If len is -1 (the default), then it is set to strlen(str). If str is 0 a null string is created. If str is "", an empty string is created.
Definition at line 17177 of file qstring.cpp. References d, fromLatin1(), p, setUnicode(), and QStringData::unicode. Referenced by setAscii(), and setNum(). |
|
|
Ensures that at least newLen characters are allocated to the string, and sets the length of the string to newLen. Any new space allocated contains arbitrary data. If newLen is 0, then the string becomes empty (non-null). If it is not possible to allocate enough memory, the string remains unchanged. This function always detaches the string from other references to the same data. This function is useful for code that needs to build up a long string and wants to avoid repeated reallocation. In this example, we want to add to the string until some condition is true, and we're fairly sure that size is big enough: QString result; int len = 0; result.setLength( maxLen ); // allocate some space while ( ... ) { result[len++] = ... // fill part of the space } result.truncate( len ); // and get rid of the rest If newLen is an underestimate, the worst that will happen is that the loop will slow down.
Definition at line 13516 of file qstring.cpp. References computeNewMax(), QShared::count, d, deref(), QStringData::len, QStringData::maxl, QT_ALLOC_QCHAR_VEC, QStringData::setDirty(), and QStringData::unicode. Referenced by countryToCode(), fromUtf8(), insert(), languageToCode(), leftJustify(), operator+=(), real_detach(), remove(), replace(), rightJustify(), simplifyWhiteSpace(), subat(), and truncate(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to the printed value of n, formatted in format f with precision prec, and returns a reference to the string. The format f can be 'f', 'F', 'e', 'E', 'g' or 'G'. See arg () for an explanation of the formats. Definition at line 16255 of file qstring.cpp. References buf, format(), qWarning(), setLatin1(), and sprintf(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to the printed value of n, formatted in format f with precision prec, and returns a reference to the string. The format f can be 'f', 'F', 'e', 'E', 'g' or 'G'. See arg () for an explanation of the formats. Definition at line 871 of file qstring.h. References setNum(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to the printed value of n in base base and returns a reference to the string. The base is 10 by default and must be between 2 and 36. Definition at line 16180 of file qstring.cpp. References buf, p, qWarning(), and setUnicode(). |
|
||||||||||||
|
Sets the string to the printed value of n in base base and returns a reference to the string. The base is 10 by default and must be between 2 and 36.
Definition at line 16132 of file qstring.cpp. References buf, FALSE, p, qWarning(), setNum(), setUnicode(), and TRUE. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to the printed value of n in base base and returns a reference to the string. The base is 10 by default and must be between 2 and 36. Definition at line 868 of file qstring.h. References setNum(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to the printed value of n in base base and returns a reference to the string. The base is 10 by default and must be between 2 and 36. Definition at line 865 of file qstring.h. References setNum(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the string to the printed value of n in base base and returns a reference to the string. The base is 10 by default and must be between 2 and 36. Definition at line 862 of file qstring.h. References setNum(). |
|
||||||||||||
|
||||||||||||
|
Resizes the string to len characters and copies unicode into the string. If unicode is 0, nothing is copied, but the string is still resized to len. If len is zero, then the string becomes a null string.
Definition at line 17101 of file qstring.cpp. References computeNewMax(), QShared::count, d, deref(), QStringData::len, makeSharedNull(), QStringData::maxl, QT_ALLOC_QCHAR_VEC, QShared::ref(), QStringData::setDirty(), shared_null, and QStringData::unicode. Referenced by Qt3::QTextFormatter::bidiReorderLine(), setLatin1(), setNum(), setUnicodeCodes(), and Qt3::QTextString::toString(). |
|
||||||||||||
|
Resizes the string to len characters and copies unicode_as_ushorts into the string (on some X11 client platforms this will involve a byte-swapping pass). If unicode_as_ushorts is 0, nothing is copied, but the string is still resized to len. If len is zero, the string becomes a null string.
Definition at line 17138 of file qstring.cpp. References setUnicode(). Referenced by QDir::absFilePath(). |
|
|
For internal use only.
Definition at line 645 of file qstring.h. References d. |
|
|
||||||||||||
|
|
|
|
Definition at line 17078 of file qstring.cpp. References d, QStringData::len, real_detach(), setLength(), and QStringData::unicode. |
|
|
Returns the string converted to a If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE.
Definition at line 16094 of file qstring.cpp. References end, latin1(), and val. Referenced by Sheet::calculateFunction(), CalculatorImpl::CalculatorImpl(), QUType_QString::convertTo(), Engine::del(), LoadInfo::getCpuInfo(), PackageListItem::key(), SubUnit::makeSubUnit(), Engine::pushValue(), QSettings::readDoubleEntry(), and toFloat(). |
|
|
Returns the string converted to a If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE.
Definition at line 16114 of file qstring.cpp. References toDouble(). Referenced by Budget::displayLineItems(), Transaction::getActualTotal(), Budget::getBudgetTotal(), Transaction::getBudgetTotal(), Checkbook::slotStartingBalanceChanged(), and TranInfo::TranInfo(). |
|
||||||||||||
|
||||||||||||
|
Returns the string converted to a If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE.
Definition at line 15886 of file qstring.cpp. References FALSE, QChar::isSpace(), l, length(), ok_in_base(), p, TRUE, unicode(), and val. Referenced by QUType_QString::convertTo(), NetworkSetup::NetworkSetup(), WLanNetNode::setSpecificAttribute(), LanCardNetNode::setSpecificAttribute(), ACable::setSpecificAttribute(), ABluetoothRFCOMM::setSpecificAttribute(), BluetoothBNEPNetNode::setSpecificAttribute(), ProfileEdit::SLOT_Refresh(), ProfileEdit::SLOT_ResetODO(), toInt(), toShort(), and QColIntValidator::validate(). |
|
||||||||||||
|
Returns the string converted to a If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE. Definition at line 16003 of file qstring.cpp. References FALSE, toLong(), and v. Referenced by VcprojGenerator::initConfiguration(), AWLan::setSpecificAttribute(), APPP::setSpecificAttribute(), AGPRSDevice::setSpecificAttribute(), and ACable::setSpecificAttribute(). |
|
||||||||||||
|
Returns the string converted to an If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE.
Definition at line 16070 of file qstring.cpp. References FALSE, toULong(), and v. Referenced by Opietooth2::OTUUID::fromString(), striphtml::getch(), PSEWidget::inverseColor(), PackageHandler::prepareInstall(), FunctionKeyboardConfig::slotChangeUnicode(), ProcessInfo::slotSendClicked(), PPPData::speed(), and TsHandler::startElement(). |
|
||||||||||||
|
Returns the string converted to an If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE.
Definition at line 15949 of file qstring.cpp. References FALSE, QChar::isSpace(), l, length(), ok_in_base(), p, TRUE, unicode(), and val. Referenced by GPRSRun::detectState(), QTReaderApp::do_jump(), AGPRSDevice::setSpecificAttribute(), toUInt(), toUShort(), and MemoryInfo::updateData(). |
|
||||||||||||
|
Returns the string converted to an If ok is not 0: if a conversion error occurs, *ok is set to FALSE; otherwise *ok is set to TRUE. Definition at line 16022 of file qstring.cpp. References FALSE, toULong(), and v. Referenced by KateCommands::Character::execCmd(). |
|
|
|
Returns the QString as a zero terminated array of unsigned shorts if the string is not null; otherwise returns zero. The result remains valid so long as one unmodified copy of the source string exists. Definition at line 16943 of file qstring.cpp. References computeNewMax(), d, QStringData::len, QStringData::maxl, QT_ALLOC_QCHAR_VEC, and QStringData::unicode. Referenced by localeAwareCompare(). |
|
|
||||||||||||
|
This utility function converts l 16-bit characters from uc to ASCII, returning a ''-terminated string. The caller is responsible for deleting the resultant string with delete[]. Definition at line 13003 of file qstring.cpp. Referenced by latin1(), and QTextStream::writeBlock(). |
|
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is not equal to s2; otherwise returns FALSE. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) != 0.
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is not equal to s2; otherwise returns FALSE. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) != 0.
|
|
||||||||||||
|
Returns TRUE if s1 is not equal to s2; otherwise returns FALSE. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) != 0.
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string which is the result of concatenating the character c and string s. Equivalent to {s}.prepend(c). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string which is the result of concatenating the string s and character c. Equivalent to {s}.append(c). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string which is the result of concatenating the character s1 and string s2. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string which is the result of concatenating the string s1 and character s2. Equivalent to {s1}.append(s2). |
|
||||||||||||
|
Returns a string which is the result of concatenating the string s1 and the string s2. Equivalent to {s1}.append(s2). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is lexically less than s2; otherwise returns FALSE. The comparison is case sensitive. Equivalent to compare(s1, s2) < 0. |
|
||||||||||||
|
Returns TRUE if s1 is lexically less than s2; otherwise returns FALSE. The comparison is case sensitive. Equivalent to compare(s1, s2) < 0. |
|
||||||||||||
|
Writes the string str to the stream s. See also Format of the QDataStream operators Definition at line 17679 of file qstring.cpp. References QDataStream::BigEndian, QDataStream::byteOrder(), QChar::cell(), l, latin1(), length(), QChar::row(), t, unicode(), QDataStream::version(), and QDataStream::writeBytes(). |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is lexically less than or equal to s2; otherwise returns FALSE. The comparison is case sensitive. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) <= 0.
|
|
||||||||||||
|
Returns TRUE if s1 is lexically less than or equal to s2; otherwise returns FALSE. The comparison is case sensitive. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1,s2) <= 0.
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is equal to s2; otherwise returns FALSE. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) == 0.
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is equal to s2; otherwise returns FALSE. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) == 0.
|
|
||||||||||||
|
Returns TRUE if s1 is equal to s2; otherwise returns FALSE. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) != 0.
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is lexically greater than s2; otherwise returns FALSE. The comparison is case sensitive. Equivalent to compare(s1, s2) > 0. Definition at line 17403 of file qstring.cpp. |
|
||||||||||||
|
Returns TRUE if s1 is lexically greater than s2; otherwise returns FALSE. The comparison is case sensitive. Equivalent to compare(s1, s2) > 0. |
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns TRUE if s1 is lexically greater than or equal to s2; otherwise returns FALSE. The comparison is case sensitive. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) >= 0.
|
|
||||||||||||
|
Returns TRUE if s1 is lexically greater than or equal to s2; otherwise returns FALSE. The comparison is case sensitive. Note that a null string is not equal to a not-null empty string. Equivalent to compare(s1, s2) >= 0.
|
|
||||||||||||
|
Reads a string from the stream s into string str. See also Format of the QDataStream operators Definition at line 17728 of file qstring.cpp. |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 663 of file qstring.h. Referenced by ascii(), checkSimpleText(), deref(), endsWith(), fill(), findArg(), insert(), isRightToLeft(), latin1(), left(), leftJustify(), length(), lower(), makeSharedNull(), mid(), operator+=(), operator=(), QIMPenChar::operator=(), QIMPenChar::QIMPenChar(), QString(), remove(), replace(), right(), rightJustify(), setExpand(), setLatin1(), setLength(), setUnicode(), simplifyWhiteSpace(), startsWith(), stripWhiteSpace(), subat(), ucs2(), upper(), utf8(), QConstString::~QConstString(), and ~QString(). |
|
|
|
Definition at line 13148 of file qstring.cpp. Referenced by deref(), QString(), setUnicode(), and ~QString(). |
1.4.2