[fpc-pascal] BoolToStr() with correct locale output

Michael Van Canneyt michael at freepascal.org
Sat Jun 27 11:41:58 CEST 2009



On Fri, 26 Jun 2009, Giuliano Colla wrote:

> Graeme Geldenhuys ha scritto:
>> Again, nothing like this is hinted at in the documentation. I'll double 
>> check on Monday what the Kylix 3 help says regarding BoolToStr and 
>> StrToBool and localization and when it should actually be used.
>> 
> Kylix 3 help on TrueBoolStrs variable specifies:
> <quote>
> When using the BoolToString function, true values are converted to the first 
> string of the list. When using the StrToBool function, any string in the list 
> is converted to true.
> </quote>
> The same for FalseBoolStrs variable, of course.
>
> Apparently the mechanism is intended to convert from human understandable or 
> localized strings to standardized TRUE/FALSE strings. The opposite of what 
> you needed. No wonder it fails for you.

But there is a bug in strtobool: it does not check all elements in the list.
(in fact, none) So that must be fixed.

Michael.



More information about the fpc-pascal mailing list