pascalscript - Convert Boolean to String with Inno Setup -


what easiest way convert boolean value string in inno setup pascal script? trivial task should implicit seems require full-blown if/else construction.

function isdowngradeuninstall: boolean; begin     result := iscommandlineparamset('downgrade');     msgbox('isdowngradeuninstall = ' + result, mbinformation, mb_ok); end; 

this doesn't work because "type mismatch". inttostr doesn't accept boolean neither. booltostr not exist.

if need once only, easiest inline solution cast boolean integer , use inttostr function. 1 true , 0 false.

msgbox('isdowngradeuninstall = ' + inttostr(integer(result)), mbinformation, mb_ok); 

though, use format function same result:

msgbox(format('isdowngradeuninstall = %d', [result]), mbinformation, mb_ok); 

(contrary delphi) inno setup/pascal script format implicitly converts boolean integer %d.


if need more fancy conversion, or if need conversion often, implement own function, @roben shows in answer.

function booltostr(value: boolean): string;  begin   if value     result := 'yes'   else     result := 'no'; end; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -