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

Giuseppe D'Angelo dangelog at gmail.com
Wed Oct 26 20:44:09 CEST 2011

2011/10/25 Antonis Tsiapaliokas <kok3rs at gmail.com>:
> So what do you think? Is there any way to add this feature or it will to
> hackish? (if we assume that we want to support for all the ways that a
> string can represent a bool...)

I think we should then really discuss about what should be considered
to be "true" (and what to be "false", so we also figure out if a "bool
*ok" parameter is actually needed or not). In my humble opinion, a
case insensitive comparison against the string "true" is too generic
and weak (not to mention English-only). If that's a way of checking
some user input I think it's simply a bad idea to have it inside

For instance, Perl thinks that empty string and the literal "0" are
false, and any other string is true. In Python and JS only the empty
strings are false. Should Qt do something similar?

Giuseppe D'Angelo

More information about the Development mailing list