Einzelnen Beitrag anzeigen

jottkaerr

Registriert seit: 2. Jul 2007
Ort: Tuttlingen
81 Beiträge
 
Delphi 10.1 Berlin Professional
 
#2

Re: SET zur Laufzeit genereieren

  Alt 14. Nov 2008, 10:33
Code:
var ByteSet: set of Byte;
begin
  Include(ByteSet, 1);
  Include(ByteSet, 3);
  ByteSet := ByteSet + [5];
  ByteSet := ByteSet + [7];

  if 4 in ByteSet then
    // ...
end;
Ob Du Include() oder den Plus-Operator nimmst, ist egal. Worauf Du allerdings achten musst, ist, dass Sets nur Werte im Bereich von 0 bis 255 enthalten dürfen.

jkr
Jürgen Krämer
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
  Mit Zitat antworten Zitat