Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
[SOLVED] Is this a valid code?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
TCollection wiki entry
by
Thaddy
[
Today
at 05:44:53 am]
I have made some progress...
by
onionmixer
[
Today
at 04:17:27 am]
New, Pascal-like programm...
by
nvitya
[
Today
at 02:37:18 am]
TDateTimePicker - Make th...
by
wp
[
Today
at 12:59:57 am]
equivalent to C/C++ "offs...
by
creaothceann
[
Today
at 12:50:49 am]
UI app to work with SQLit...
by
LeP
[
Today
at 12:50:04 am]
Elite Arcade
by
Guva
[July 11, 2026, 11:25:29 pm]
Freepascal
by
marcelomaurinmartins@gmai
[July 11, 2026, 11:24:44 pm]
International Pascal Cong...
by
vincococka
[July 11, 2026, 11:18:49 pm]
Printing on HP Smart Tank
by
JerryHudson
[July 11, 2026, 10:22:12 pm]
Help needed on how to do ...
by
cdbc
[July 11, 2026, 08:38:38 pm]
Why is my program freezin...
by
paweld
[July 11, 2026, 07:19:46 pm]
is there PDS reader/expor...
by
jamie
[July 11, 2026, 07:01:12 pm]
Fpcupdeluxe
by
cdbc
[July 11, 2026, 06:40:29 pm]
weird error message
by
jamie
[July 11, 2026, 06:37:01 pm]
Como compilar uma lib par...
by
marcelomaurinmartins@gmai
[July 11, 2026, 06:24:51 pm]
Desenvolvimento visual pa...
by
marcelomaurinmartins@gmai
[July 11, 2026, 06:19:16 pm]
OpenDocument('Filename') ...
by
J-G
[July 11, 2026, 06:13:03 pm]
TTL Record Count, i.e. a ...
by
1HuntnMan
[July 11, 2026, 06:05:29 pm]
Using callback
by
LemonParty
[July 11, 2026, 05:43:15 pm]
Source Editor Collapsed P...
by
J-G
[July 11, 2026, 11:17:14 am]
Habari STOMP Clients for ...
by
mjustin
[July 11, 2026, 11:15:54 am]
Questions on slight diffe...
by
egsuh
[July 11, 2026, 09:45:30 am]
Have anybody used Horse f...
by
egsuh
[July 11, 2026, 08:31:21 am]
Problems with creating a ...
by
jamie
[July 11, 2026, 12:10:44 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Is this a valid code? (Read 543 times)
egsuh
Hero Member
Posts: 1817
[SOLVED] Is this a valid code?
«
on:
April 12, 2025, 11:03:52 am »
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]
[+]
[-]
function
TBlockStart
.
getLoopSelect
:
boolean
;
begin
try
Result
:
=
StrToBool
(
Options
[
'LoopSelect'
]
)
;
except
Result
:
=
False
;
end
;
end
;
«
Last Edit: April 12, 2025, 12:48:10 pm by egsuh
»
Logged
Paolo
Hero Member
Posts: 738
Re: Is this a valid code?
«
Reply #1 on:
April 12, 2025, 12:17:50 pm »
Trystrtobool my help here ?
Logged
n7800
Hero Member
Posts: 729
Lazarus IDE contributor
Re: Is this a valid code?
«
Reply #2 on:
April 12, 2025, 12:23:22 pm »
Actually, there is
StrToBoolDef
for this:
Code: Pascal
[Select]
[+]
[-]
function
StrToBoolDef
(
const
S
:
string
;
Default
:
Boolean
)
:
Boolean
;
Logged
n7800
Hero Member
Posts: 729
Lazarus IDE contributor
Re: Is this a valid code?
«
Reply #3 on:
April 12, 2025, 12:25:46 pm »
By the way, there are global arrays
TrueBoolStrs
and
FalseBoolStrs
, in which you can specify acceptable values.
Logged
egsuh
Hero Member
Posts: 1817
Re: Is this a valid code?
«
Reply #4 on:
April 12, 2025, 12:47:45 pm »
function StrToBoolDef(const S: string; Default: Boolean): Boolean;
This really helps, and good enough. Thank you very much.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
[SOLVED] Is this a valid code?
TinyPortal
© 2005-2018