[Interest] unexpected result from QString::compare
Hamish Moffatt
hamish at risingsoftware.com
Fri May 8 14:05:43 CEST 2020
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.
Hamish
More information about the Interest
mailing list