RosettaCodeData/Task/Empty-string/Component-Pascal/empty-string.pas

20 lines
511 B
ObjectPascal
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
MODULE EmptyString;
IMPORT StdLog;
PROCEDURE Do*;
VAR
2026-02-01 16:33:20 -08:00
s: ARRAY 64 OF CHAR;
(* s := "" <=> s[0] := 0X => s isEmpty*)
2023-07-01 11:58:00 -04:00
BEGIN
2026-02-01 16:33:20 -08:00
s := "";
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = "");StdLog.Ln;
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # "");StdLog.Ln;
StdLog.Ln;
(* Or *)
s := 0X;
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = 0X);StdLog.Ln;
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # 0X);StdLog.Ln;
StdLog.Ln;
2023-07-01 11:58:00 -04:00
END Do;
END EmptyString.