#1 2010-05-30 10:58

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Script: How to convert an boolean value to an string

Question:
How to convert an boolean value to an string?

ShowMessage('bRegExCaseSensitive: '   + bRegExCaseSensitive);

I expect an MsgBox like: [ bRegExCaseSensitive: True ]


Is there some conversion like BoolToStr(bRegExCaseSensitive);  or what??? i didn't find any solution for that right now.

Thanky iA for any help  smile


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#2 2010-05-30 12:52

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,376

Re: Script: How to convert an boolean value to an string

I thought it was trivial because it can be defined as:

function MyBoolToStr(B: Boolean): String;
begin
  if B then
    Result := 'True'
  else
    Result := 'False';
end;

Anyway, I have added BoolToStr function.

Offline

#3 2010-05-30 14:44

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Script: How to convert an boolean value to an string

den4b wrote:

I thought it was trivial because it can be defined as:

function MyBoolToStr(B: Boolean): String;
begin
  if B then
    Result := 'True'
  else
    Result := 'False';
end;

It would had taken a great while till *i* would come to such solution
Specially because I searched for an ready-to-use option... thinking i just didn't found it.
(but now i wonder why i didn't had this solution in mind... i had just could used two IF statements at least...  i think it was because i had to think for other solutions at that time and had not more resources left).

Now i remember to have seen this piece of code in the past too.

Anyway, I have added BoolToStr function.

Thanks for that, now even i can remeber that.

333


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

Board footer

Powered by FluxBB