summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-02-04 13:05:06 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2017-04-03 15:41:09 +0000
commitd40dcee642c69784f771aae86531ae65b458f1a5 (patch)
treecc96f153042a48a770e6b34fe200e7e95c877707 /src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp
parentb8c61c6bb35c49fc8a6aed4925e59ba1694eab19 (diff)
QStringIterator: port to QStringView
Pretty straightforward, as the implementation already used only an iterator range internally. Change-Id: I6e6b809329e2e2548bba6db414a3d107d09637d1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp
index 1fcb7b9945..7a2b4812ef 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp
@@ -58,7 +58,7 @@ int main()
{
//! [0]
QString string(QStringLiteral("a string"));
-QStringIterator i(string);
+QStringIterator i(string); // implicitly converted to QStringView
//! [0]
//! [1]
@@ -71,8 +71,7 @@ while (i.hasNext())
{
//! [2]
-QString string(QStringLiteral("𝄞 is the G clef"));
-QStringIterator i(string);
+QStringIterator i(u"𝄞 is the G clef");
qDebug() << hex << i.next(); // will print 1d11e (U+1D11E, MUSICAL SYMBOL G CLEF)
qDebug() << hex << i.next(); // will print 20 (U+0020, SPACE)
qDebug() << hex << i.next(); // will print 69 (U+0069, LATIN SMALL LETTER I)