Skip to content

Instantly share code, notes, and snippets.

@Niceblack
Created October 21, 2014 21:47
Show Gist options
  • Save Niceblack/27a65d0a9e1920024367 to your computer and use it in GitHub Desktop.
Save Niceblack/27a65d0a9e1920024367 to your computer and use it in GitHub Desktop.
// Запись ключей (-a, -b и т.п.) из аргументов командной строки в set of char
Program CommandLineKeys;
var
keys: set of Char;
s: String;
i: Integer;
begin
keys := [];
// Разбор командной строки
for i := 1 to ParamCount do begin
s := ParamStr(i);
if (s[1] = '-') then begin
Include(keys, s[2]);
end;
end;
// Проверка ключей
if 'a' in keys then WriteLn('Key: -a');
if 'b' in keys then WriteLn('Key: -b');
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment