[Development] New feature to qstring | QString::toBool()

Christoph Feck christoph at maxiom.de
Wed Oct 26 23:27:13 CEST 2011


On Tuesday 25 October 2011 22:53:02 Frans Klaver wrote:
> Hi,
> 
> On Tue, 25 Oct 2011 22:19:29 +0200, Antonis Tsiapaliokas
> 
> <kok3rs at gmail.com> wrote:
> > Also, please read the comment from the John Brooks, which i think
> > that he isright. So what do you think?
> 
> I would say he is right. He strongly hints at the possibility that
> bool is too context dependent. And I agree with that.
> 
> This thing is tricky to tackle. QString was created to easily
> handle localization. Chances are you are going to not only
> interpret true/false, but also ja/(nee|nein|nej), oui/non, si/no
> and whatever may mean true or yes (or OK?) in whatever language.
> What if a language introduces a new word to mean true? You just
> don't have to handle natural language issues with doubles, floats
> and integers, which is why that can be done by QString hands down.

As far as I remember, POSIX locales offer strings or regexps for YES 
and NO, so it might be possible to add something to QLocale to access 
those strings.

-- 
Christoph Feck
http://kdepepo.wordpress.com/
KDE Quality Team



More information about the Development mailing list