合并字符串
第一种
Qstring str1 = "hello ";
str1 = str1 + “world”;
qDebug() << str1;
QString str2 = "I love ";
str2 += “you!”;
cout << str1.toStdString() << endl << str2.toStdString() << endl;
第二种
QString str3 = "Welcome ";
QString str4 = "to ";
str3.append(str4);
第三种
QString str5;
str5 = QString(“I bought %1 pounds %2 apples”).arg(10).arg(“red”);
第四种
QString str6;
sr6 = str6.asprintf(“%s”, “welcome”);
QByteArray ba = str6.toLocal8Bit();
const char * c_str = ba.data();
str6 = QString::asprintf(“%s %s %s”, c_str, “to”, “the future!”);