[Interest] unexpected result from QString::compare

Hamish Moffatt hamish at risingsoftware.com
Mon May 11 10:23:05 CEST 2020


On 9/5/20 12:35 am, Thiago Macieira wrote:

> On Friday, 8 May 2020 05:05:43 PDT Hamish Moffatt wrote:
>
>> localeAwareCompare() is working as expected.

Unfortunately, it doesn't allow the case sensitivity to be specified 
(unlike QCollator::compare() and QString::compare()), which makes it 
less useful than it could be.

> Consider QCollator too.
>

Thanks, that solves my next problem of how to compare in locales other 
than the default.

I notice that QString::localeAwareCompare() internally uses a QCollator, 
which it defines as;

Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)

Why does it need an instance per thread?



Hamish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200511/d69ce947/attachment.html>


More information about the Interest mailing list