Qt
6.x
The Qt SDK
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
8
int
main
()
9
{
10
11
{
13
QString
string
(
QStringLiteral
(
"a string"
));
14
QStringIterator
i
(
string
);
// implicitly converted to QStringView
16
18
while
(
i
.hasNext())
19
char32_t
c
=
i
.next();
21
}
22
23
{
25
QStringIterator
i
(u
"𝄞 is the G clef"
);
26
qDebug
() <<
Qt::hex
<<
i
.next();
// will print '𝄞' (U+1D11E, MUSICAL SYMBOL G CLEF)
27
qDebug
() <<
Qt::hex
<<
i
.next();
// will print ' ' (U+0020, SPACE)
28
qDebug
() <<
Qt::hex
<<
i
.next();
// will print 'i' (U+0069, LATIN SMALL LETTER I)
30
}
31
32
}
QStringIterator
Definition
qstringiterator_p.h:25
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:127
i
i
[1]
Definition
doc_src_containers.cpp:167
Qt::hex
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
Definition
qtextstream.cpp:2601
qDebug
#define qDebug
[1]
Definition
qlogging.h:160
c
const GLubyte * c
Definition
qopenglext.h:12701
string
GLsizei const GLchar *const * string
[0]
Definition
qopenglext.h:694
QStringLiteral
#define QStringLiteral(str)
Definition
qstringliteral.h:36
main
int main()
Definition
src_corelib_text_qstringiterator.cpp:8
qtbase
src
corelib
doc
snippets
code
src_corelib_text_qstringiterator.cpp
Generated by
1.9.7