1、实现效果
QString a = "1,2,3,4,5";
得到
QStringList b = {"1","2","3","4","5"}
2、实现
QString str = "a,,b,c"; QStringList list1 = str.split(','); // list1: [ "a", "", "b", "c" ] QStringList list2 = str.split(',', QString::SkipEmptyParts); // list2: [ "a", "b", "c" ]