[Interest] unexpected result from QString::compare
Thiago Macieira
thiago.macieira at intel.com
Fri May 8 16:35:39 CEST 2020
On Friday, 8 May 2020 05:05:43 PDT Hamish Moffatt wrote:
> On 8/5/20 6:54 pm, Florian Bruhin wrote:
> > On Fri, May 08, 2020 at 08:51:19AM +0000, Hamish Moffatt wrote:
> >> On 8/5/20 5:13 pm, Fabrice Mousset | GEOCEPT GmbH wrote:
> >>> Perhaps you should use QString::localeAwareCompare() ?
> >>
> >> Thanks, I didn't know about that. Maybe the QString::compare()
> >> documentation could mention it...
> >>
> > From https://doc.qt.io/qt-5/qstring.html#compare :
> > Case sensitive comparison is based exclusively on the numeric Unicode
> > values of the characters and is very fast, but is not what a human
> > would expect. Consider sorting user-visible strings with
> > localeAwareCompare().
>
> Oh thanks, I'm at 0/2 today it seems. I looked at the compare() overload
> I'm using and missed this reference further up.
>
> localeAwareCompare() is working as expected.
Consider QCollator too.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel System Software Products
More information about the Interest
mailing list