diff options
Diffstat (limited to 'src/corelib/doc/snippets/qstring/main.cpp')
-rw-r--r-- | src/corelib/doc/snippets/qstring/main.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 3d09e3618e..b936f0c057 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -750,7 +750,6 @@ void Widget::sizeFunction() int n = str.size(); // n == 5 str.data()[0]; // returns 'W' str.data()[4]; // returns 'd' - str.data()[5]; // returns '\0' //! [58] } @@ -810,6 +809,18 @@ void Widget::splitCaseSensitiveFunction() QStringList list2 = str.split(',', QString::SkipEmptyParts); // list2: [ "a", "b", "c" ] //! [62] + + //! [62-empty] + QString str = "abc"; + auto parts = str.split(""); + // parts: {"", "a", "b", "c", ""} + //! [62-empty] + + //! [62-slashes] + QString str = "/a/b/c/"; + auto parts = str.split('/'); + // parts: {"", "a", "b", "c", ""} + //! [62-slashes] } void Widget::sprintfFunction() |