Re: [fpc-pascal] BoolToStr

2022-09-01 Thread Zeljko Avramovic via fpc-pascal
> > You can use > > BoolToStr(b,'TRUE','FALSE') > > That works great! Shouldn't that be the default and you can put in > something else if you want it? Latest trunk allows you this if you include new syshelpers unit: True.ToString; // True

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread Michael Van Canneyt via fpc-pascal
On Mon, 29 Aug 2022, James Richters via fpc-pascal wrote: Thanks for the discussion everyone, it does shed some light on what's going on. I agree it would be impossible to change it now, It was actually a GREAT idea to make it customizable, and that serves my needs just fine. I guess all

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread James Richters via fpc-pascal
Thanks for the discussion everyone, it does shed some light on what's going on. I agree it would be impossible to change it now, It was actually a GREAT idea to make it customizable, and that serves my needs just fine. I guess all that's left is to update the documentation to show what it

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread Nikolay Nikolov via fpc-pascal
On 8/29/22 11:33, Jean SUZINEAU via fpc-pascal wrote: Le 29/08/2022 à 01:41, James Richters via fpc-pascal a écrit : If a special function is needed for some COM thing or weird Winapi thing, then that function should be part of the unit that needs it, not modifying the generic function

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread Jean SUZINEAU via fpc-pascal
Le 29/08/2022 à 01:41, James Richters via fpc-pascal a écrit : If a special function is needed for some COM thing or weird Winapi thing, then that function should be part of the unit that needs it, not modifying the generic function intended to be used for general purpose applications output

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread Michael Van Canneyt via fpc-pascal
On Sun, 28 Aug 2022, James Richters via fpc-pascal wrote: I'm curious if there is a way to search the FPC version history of changes for BoolToStr to see why it was changed, and see if there is a valid reason not to change it back. it was obviously changed from the way the documentations is

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread Sven Barth via fpc-pascal
Am 29.08.2022 um 01:41 schrieb James Richters via fpc-pascal: I'm curious if there is a way to search the FPC version history of changes for BoolToStr to see why it was changed, and see if there is a valid reason not to change it back. it was obviously changed from the way the documentations

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread James Richters via fpc-pascal
I don't see how it makes anything compatible at all.. because it's NOT a 0 or a -1 integer value, it's a STRING of '0' or '-1' so you can't even evaluate the negative bit.. because there isn't one, it's a string of - and 1. You would have to do StrToInt(BoolToStr(MyVariable)) to be able to

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread Marco van de Voort via fpc-pascal
Op 8/28/2022 om 8:45 PM schreef Ralf Quint via fpc-pascal: On 8/28/2022 8:23 AM, James Richters via fpc-pascal wrote: Running "i:\booltostr.exe " -1 0 Why true is -1 instead of 1 is beyond me, but anyway, I would consider this BoolToInt, not BoolToStr,I want the Strings ‘TRUE’ or ‘FALSE’

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread James Richters via fpc-pascal
eds. James. -Original Message- From: fpc-pascal On Behalf Of Michael Van Canneyt via fpc-pascal Sent: Sunday, August 28, 2022 11:39 AM To: ja...@productionautomation.net; FPC-Pascal users discussions Cc: Michael Van Canneyt ; James Richters Subject: Re: [fpc-pascal] BoolToStr On Sun,

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread Ralf Quint via fpc-pascal
On 8/28/2022 8:23 AM, James Richters via fpc-pascal wrote: Running "i:\booltostr.exe " -1 0 Why true is -1 instead of 1 is beyond me, but anyway, I would consider this BoolToInt, not BoolToStr,I want the Strings ‘TRUE’ or ‘FALSE’ as indicated in the documentation Very logical in fact. 0

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread Michael Van Canneyt via fpc-pascal
On Sun, 28 Aug 2022, James Richters via fpc-pascal wrote: I'm generating a report where I wish to display some Boolean values. I thought I would try BoolToStr, as according to: https://www.freepascal.org/docs-html/rtl/sysutils/booltostr.html it states: Description BoolToStr converts the

[fpc-pascal] BoolToStr

2022-08-28 Thread James Richters via fpc-pascal
I'm generating a report where I wish to display some Boolean values. I thought I would try BoolToStr, as according to: https://www.freepascal.org/docs-html/rtl/sysutils/booltostr.html it states: Description BoolToStr converts the boolean B to one of the strings 'TRUE' or 'FALSE' So it should

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

2009-06-27 Thread Michael Van Canneyt
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

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

2009-06-26 Thread Graeme Geldenhuys
Hi, I'm busy translating our projects. fpGUI Toolkit uses it's own translation via .po files (similar to Lazarus projects). But now there are some output that is not being translated because it is output from the RTL. One such case is the output of BoolToStr(). How am I supposed to translate

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

2009-06-26 Thread Michael Van Canneyt
On Fri, 26 Jun 2009, Graeme Geldenhuys wrote: Hi, I'm busy translating our projects. fpGUI Toolkit uses it's own translation via .po files (similar to Lazarus projects). But now there are some output that is not being translated because it is output from the RTL. One such case is the output

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

2009-06-26 Thread Graeme Geldenhuys
Michael Van Canneyt wrote: So all you need to do is initialize them with the localized versions prior to the first call of BoolToStr(). Thanks Michael. Now the other obvious question, why is TrueBoolStrs and FalseBoolStrs array types? Why not simply of type String?

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

2009-06-26 Thread Michael Van Canneyt
On Fri, 26 Jun 2009, Graeme Geldenhuys wrote: Michael Van Canneyt wrote: So all you need to do is initialize them with the localized versions prior to the first call of BoolToStr(). Thanks Michael. Now the other obvious question, why is TrueBoolStrs and FalseBoolStrs array types? Why

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

2009-06-26 Thread Graeme Geldenhuys
Michael Van Canneyt wrote: StrToBool should use all elements ? In FPC 2.2.5 it does not. implementation = begin if UseBoolStrs Then begin CheckStrs; if B then Result:=TrueBoolStrs[0] else Result:=FalseBoolStrs[0]; end else If B

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

2009-06-26 Thread Graeme Geldenhuys
Michael Van Canneyt wrote: StrToBool should use all elements ? In FPC 2.3.x (latest trunk) in also doesn't. Looks indentical to 2.2.5 Regards, - Graeme - ___ fpGUI - a cross-platform GUI toolkit using Free Pascal

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

2009-06-26 Thread Vincent Snijders
Graeme Geldenhuys schreef: Michael Van Canneyt wrote: StrToBool should use all elements ? In FPC 2.2.5 it does not. implementation = begin if UseBoolStrs Then begin CheckStrs; if B then Result:=TrueBoolStrs[0] else

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

2009-06-26 Thread Graeme Geldenhuys
Vincent Snijders wrote: Please add the declaration, to make sure it is StrToBool I'm not that blind. :-) And the function in question in BoolToStr(). But now that you mention StrToBool(), that is even worse, it hard-codes the 'FALSE' and 'TRUE' and doesn't even use the arrays. How come

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

2009-06-26 Thread Vincent Snijders
Graeme Geldenhuys schreef: Vincent Snijders wrote: Please add the declaration, to make sure it is StrToBool I'm not that blind. :-) And the function in question in BoolToStr(). But now that you mention StrToBool(), that is even worse, it hard-codes I did not mention StrToBool first,

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

2009-06-26 Thread Henry Vermaak
2009/6/26 Graeme Geldenhuys grae...@opensoft.homeip.net: How come nobody ever noticed this? Does everybody only write English programs. :-) Because it's so simple/trivial that everyone rolls their own for user interfaces? I know I do. Henry ___

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

2009-06-26 Thread Henry Vermaak
2009/6/26 Vincent Snijders vsnijd...@vodafonevast.nl: Graeme Geldenhuys schreef: How come nobody ever noticed this? Does everybody only write English programs. :-) Because I always thought these function were not for users, but for systems, for example to store a boolean in a xml file or

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

2009-06-26 Thread Graeme Geldenhuys
Vincent Snijders wrote: I did not mention StrToBool first, Michael did, and you seemed to ignore that. Sorry, that one slipped by me unnoticed Regards, - Graeme - fpGUI - a cross-platform Free Pascal GUI toolkit

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

2009-06-26 Thread Graeme Geldenhuys
Vincent Snijders wrote: Because I always thought these function were not for users, but for systems, for example to store a boolean in a xml file or to create an Your example is a good one and I agree there, but I do think it's for users to. For example, the whole reason I noticed the

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

2009-06-26 Thread Graeme Geldenhuys
Henry Vermaak wrote: I think even for config/system files they are useless, since it's a lot more friendly to support yes/no, true/false and on/off, not just true/false. Maybe that was the idea behind the TrueBoolStrs array. Element 0 is true/false, element 1 maybe yes/no, element 3 maybe

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

2009-06-26 Thread John Coppens
On Fri, 26 Jun 2009 15:54:55 +0100 Henry Vermaak henry.verm...@gmail.com wrote: How come nobody ever noticed this? Does everybody only write English programs. :-) I _hate_ to think of the consequences of localization of those strings. Have we had enough of the . and , problem? I don't think

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

2009-06-26 Thread Giuliano Colla
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

[fpc-pascal] booltostr, compability issue

2006-12-29 Thread Marco van de Voort
I just fixed booltostr in 2.1.1 to be D7 compat. This is one of the stupidest Delphi changes I ever saw, but anyway, compability is compability. Booltostr now returns -1 and 0, and only True and False if you pass true to the 2nd parameter which is default false. You can influence the outcome