[Development] toLower() vs. toCaseFolded()
Thiago Macieira
thiago.macieira at intel.com
Wed Dec 9 22:27:09 CET 2015
On Wednesday 09 December 2015 22:56:48 Marc Mutz wrote:
> On Wednesday 09 December 2015 11:54:54 Marc Mutz wrote:
> > Can someone please tell me the difference and why toCaseFolded() exists in
> > the first place? Is it faster? Is it guaranteed to not make the string
> > longer/shorter?
>
> To be more precise: I'd like the docs to say when I should use
> toCaseFolded() or toLower(). Since the Unicode docs linked say
> toCaseFolded() is locale- dependent, as an API user I'd also wonder which
> locale the QString function uses.
QString is *not* locale dependent and must not be. toCaseFolding does not
imply that. We have no code for doing Turkic (Turkish and Azerbaijani) case
mapping of i/İ/ı/I along with i̇/İ.
We could add overloads to the case mapping functions that take an extra enum
indicating whether to do the "T" mapping and we should add QLocale overloads
too that enable it automatically depending on locale.
Another alternative is to add a new class that does locale-specific case
mapping, along with natural sorting. For example, when title-casing in French,
you drop accents ("école" becomes "Ecole"). Assuming such data exists and is
implemented in ICU.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list