Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_text_qstringiterator.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 KlarƤlvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QString>
5#include <QStringIterator>
6#include <QDebug>
7
8int main()
9{
10
11{
12//! [0]
13QString string(QStringLiteral("a string"));
14QStringIterator i(string); // implicitly converted to QStringView
15//! [0]
16
17//! [1]
18while (i.hasNext())
19 char32_t c = i.next();
20//! [1]
21}
22
23{
24//! [2]
25QStringIterator i(u"𝄞 is the G clef");
26qDebug() << Qt::hex << i.next(); // will print '𝄞' (U+1D11E, MUSICAL SYMBOL G CLEF)
27qDebug() << Qt::hex << i.next(); // will print ' ' (U+0020, SPACE)
28qDebug() << Qt::hex << i.next(); // will print 'i' (U+0069, LATIN SMALL LETTER I)
29//! [2]
30}
31
32}
int main()
[open]