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
stringbuilder.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QString>
5
6using namespace Qt::StringLiterals;
7
10 QString type = "long";
11
12 foo = "vector<"_L1 + type + ">::iterator"_L1;
13
14 if (foo.startsWith("(" + type + ") 0x"))
15 ...
17
19 #include <QStringBuilder>
20
21 QString hello("hello");
26
28 QString str("QStringBuilder");
29
30 // "s" type is deduced as QStringBuilder<...>
31 auto s = "Like hot glue, " % str % " concatenates strings";
32
33 // Similarly the return type of this lambda is deduced as QStringBuilder<...>
34 auto concatenateStr = []() {
35 return "Like hot glue, " % str % " concatenates strings";
36 };
38
40 QString s = "Like hot glue, " % str % " concatenates strings";
41
42 // With a lambda, specify a trailing return type:
43 auto concatenateStr = []() -> QString {
44 return "Like hot glue, " % str % " concatenates strings";
45 };
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition qstring.cpp:5455
GLenum type
GLuint GLsizei const GLchar * message
GLdouble s
[6]
Definition qopenglext.h:235
HelloWorldTask * hello
QString str("QStringBuilder")
[5]
QStringView el
QLatin1StringView world("world")
auto concatenateStr
QString foo
[0]