Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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{
13QString string(QStringLiteral("a string"));
14QStringIterator i(string); // implicitly converted to QStringView
16
18while (i.hasNext())
19 char32_t c = i.next();
21}
22
23{
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)
30}
31
32}
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
#define qDebug
[1]
Definition qlogging.h:164
const GLubyte * c
GLsizei const GLchar *const * string
[0]
Definition qopenglext.h:694
#define QStringLiteral(str)