Skip to content

Instantly share code, notes, and snippets.

@FrBrGeorge
Created October 3, 2021 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FrBrGeorge/d6c84f8ffa50b178a85d610d5a23d23f to your computer and use it in GitHub Desktop.
Save FrBrGeorge/d6c84f8ffa50b178a85d610d5a23d23f to your computer and use it in GitHub Desktop.
check if time is in hh:mm:ss format
procedure Check(d: string; var res: boolean; var hms: vec);
var
i, r: integer;
begin
res := length(d) = 8;
if not res then exit;
res := (d[3] = ':') AND (d[6] = ':');
if not res then exit;
for i:=1 to 3 do
begin
val(copy(d, 1+(i-1)*3, 2), hms[i], r);
res := r = 0;
if not res then exit;
end;
res := (hms[1] <= 24) AND (hms[2] <= 60) and (hms[3] <= 60);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment