[SOLVED] Is this a valid code? lazarus / 21-General ---------------------------------------------------------------------- egsuh · 2025-04-12 09:03 In following example, if Options['LoopSelect'] is not 'true' or 'false' then EConvertError will be raised. I'd like to treat '' as false. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TBlockStart.getLoopSelect: boolean;begin   try      Result := StrToBool(Options['LoopSelect']);   except      Result := False;   end;end; ---------------------------------------------------------------------- Paolo · 2025-04-12 10:17 Trystrtobool my help here ? ---------------------------------------------------------------------- n7800 · 2025-04-12 10:23 Actually, there is StrToBoolDef for this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function StrToBoolDef(const S: string; Default: Boolean): Boolean; ---------------------------------------------------------------------- n7800 · 2025-04-12 10:25 By the way, there are global arrays TrueBoolStrs and FalseBoolStrs, in which you can specify acceptable values. ---------------------------------------------------------------------- egsuh · 2025-04-12 10:47 function StrToBoolDef(const S: string; Default: Boolean): Boolean; This really helps, and good enough. Thank you very much.