Skip to content

Instantly share code, notes, and snippets.

@FrBrGeorge
Created October 3, 2021 14:22
Show Gist options
  • Select an option

  • Save FrBrGeorge/d6c84f8ffa50b178a85d610d5a23d23f to your computer and use it in GitHub Desktop.

Select an option

Save FrBrGeorge/d6c84f8ffa50b178a85d610d5a23d23f to your computer and use it in GitHub Desktop.

Revisions

  1. FrBrGeorge created this gist Oct 3, 2021.
    16 changes: 16 additions & 0 deletions task2.pas
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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;