diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-11-09 14:04:57 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-11-11 12:48:21 +0100 |
commit | bd3a1dd9c287e0a1c35d013c57d83a55de52a470 (patch) | |
tree | 0bc28643dc53248ab007edf5b8debaf67e43f03c /src/corelib/doc | |
parent | 15f55e9be57822b2c9ceb602cabd5075c1921ed2 (diff) |
Doc: Update/scrub QString documentation
Fixes: QTBUG-86554
Change-Id: I3d40295115207c430ec30bbac6fb241bf897e5fa
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/qstring/main.cpp | 24 | ||||
-rw-r--r-- | src/corelib/doc/snippets/qstring/stringbuilder.cpp | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 419b98366d..8abe69ed42 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -85,9 +85,9 @@ public: void isNullFunction(); void isEmptyFunction(); void lastIndexOfFunction(); - void leftFunction(); + void firstFunction(); void leftJustifiedFunction(); - void midFunction(); + void slicedFunction(); void numberFunction(); void prependFunction(); @@ -95,7 +95,7 @@ public: void replaceFunction(); void reserveFunction(); void resizeFunction(); - void rightFunction(); + void lastFunction(); void rightJustifiedFunction(); void sectionFunction(); void setNumFunction(); @@ -164,7 +164,7 @@ void Widget::atFunction() //! [3] QString str; - for (int i = 0; i < str.size(); ++i) { + for (qsizetype i = 0; i < str.size(); ++i) { if (str.at(i) >= QChar('a') && str.at(i) <= QChar('f')) qDebug() << "Found character in range [a-f]"; } @@ -197,7 +197,7 @@ void Widget::index() { //! [6] QString str = "We must be <b>bold</b>, very <b>bold</b>"; - int j = 0; + qsizetype j = 0; while ((j = str.indexOf("<b>", j)) != -1) { qDebug() << "Found <b> tag at index position" << j; @@ -478,11 +478,11 @@ void Widget::lastIndexOfFunction() //! [94] } -void Widget::leftFunction() +void Widget::firstFunction() { //! [31] QString x = "Pineapple"; - QString y = x.left(4); // y == "Pine" + QString y = x.first(4); // y == "Pine" //! [31] } @@ -499,12 +499,12 @@ void Widget::leftJustifiedFunction() //! [33] } -void Widget::midFunction() +void Widget::slicedFunction() { //! [34] QString x = "Nine pineapples"; - QString y = x.mid(5, 4); // y == "pine" - QString z = x.mid(5); // z == "pineapples" + QString y = x.sliced(5, 4); // y == "pine" + QString z = x.sliced(5); // z == "pineapples" //! [34] } @@ -623,11 +623,11 @@ void Widget::resizeFunction() //! [47] } -void Widget::rightFunction() +void Widget::lastFunction() { //! [48] QString x = "Pineapple"; - QString y = x.right(5); // y == "apple" + QString y = x.last(5); // y == "apple" //! [48] } diff --git a/src/corelib/doc/snippets/qstring/stringbuilder.cpp b/src/corelib/doc/snippets/qstring/stringbuilder.cpp index 74623aeb94..b81b40e10e 100644 --- a/src/corelib/doc/snippets/qstring/stringbuilder.cpp +++ b/src/corelib/doc/snippets/qstring/stringbuilder.cpp @@ -52,7 +52,7 @@ QString foo; QString type = "long"; - foo->setText(QLatin1String("vector<") + type + QLatin1String(">::iterator")); + foo = QLatin1String("vector<") + type + QLatin1String(">::iterator"); if (foo.startsWith("(" + type + ") 0x")) ... |