How to use quotation marks in QStrings?
-
wrote on 21 Jul 2019, 22:37 last edited by
Hi,
I was wondering:
When I use something like this, how do I have it get quotation marks in the output?qDebug() << "I want this to display in quotation marks:\n";
Like, this doesn't work:
qDebug() << ""I want this to display in quotation marks:\n"";
Thanks in advance!
-
Hi,
I was wondering:
When I use something like this, how do I have it get quotation marks in the output?qDebug() << "I want this to display in quotation marks:\n";
Like, this doesn't work:
qDebug() << ""I want this to display in quotation marks:\n"";
Thanks in advance!
wrote on 21 Jul 2019, 23:13 last edited by -
"
is a special character inside a string, so, like with\n
you need to escape it with\
:qDebug() << "\"I want this to display in quotation marks:\n\"";
or with C++11 you can use it unescaped enclosed in
R"(
and)"
qDebug() << R"("I want this to display in quotation marks: ")";
1/3