#include <QtAlgorithms>
#include <Qdebug>
bool LessThan(const QString &s1, const QString &s2)
{
return (s1.localeAwareCompare(s2) < 0);
}
int main{}
{
QStringList list;
list << "中中句" << "方法" << "中句中" << "种" << "句外" << "中中" << "句章 << "强蛟厂" << "甜甜" << "章章";
std::sort(list.begin(), list.end(), LessThan);
qDebug() << list;
return 0;
}
结果打印:
("方法", "句黑", "句例", "句外", "句章", "强蛟厂", "甜甜", "章章", "中句中", "中中", "中中句", "种")