[笔记]QString与QStringList转换、QStringList取值

QStringList转QString

QStringList strList;
strList<<"str1"<<"str2"<<"str3";
QString str = strList.join(",");

QString转QStringList

QString str = "str1,str2,str3";
QStringList list1 = str.split(",");
QStringList list2 = str.split(",", QString::SkipEmptyParts);

QString取值

QString str = "good job";
QString x = str.left(4);   //x = "good"
QString y = str.right(3); //y = "job"
QString z = str.mid(2,2);  //z = "od"

你可能感兴趣的:([笔记]QString与QStringList转换、QStringList取值)