Qt5学习笔记 2.1_字符串类
操作字符串 字符串拼接的五种方法 /******************************操作字符串******************************/ /***first***/ QString str1="welcome ";//str1="welcome" str1=str1+"to you! ";//str1="welcome to you!" qDebug("str1=%s\n",qPrintable(str1)); /***second***/ QString str2="Hellow! ";//str2="Hellow! " str1.append(str2);//str1="welcome to you! Hellow! " str1.append("you! ");//str1="welcome to you! Hellow! you! " qDebug("str1=%s\n", qPrintable(str1)); /***third***/ QString str3; str3.sprintf("%s", " welcome ");//str3= " welcome " str3.sprintf("%s", " to you! ");//str3=" welcome to you! " str3.sprintf("%s %s",