Used to test if a value is a member of a set
  Ordinal expression in Set expression
The In keyword tests whether a value is in a set. It returns true if it is, false if not.
Sets are limited to 256 different values. Each element is equated with the Integer values 0,1,2 ... 255

Integer sets map directly to these element values, and are therefore limited to a high value of 255.

However, you may compare a value greater than 255 with an Integer set. Delphi simply uses the lowest byte of the Integer. For example, a test value of 258 would have a lower byte value of 3.
Related commands
Exclude Exclude a value in a set variable
Include Include a value in a set variable
Set Defines a set of up to 255 distinct values
 Author links

 Buy Website Traffic at

 Buy Proxies at
 Download this web site as a Windows program.

Example code : Determine whether a character is a letter
  IsLetter('G');  // G is a letter of the (uppercase) alphabet
  IsLetter('1');  // 1 is not a letter

// Test if a character is a letter
procedure TForm1.IsLetter(Letter : char);
  Alphabet : set of 'A'..'Z';

  Alphabet := ['A'..'Z'];

  if Letter In Alphabet then
    ShowMessage(Letter+' is in the alphabet')
    ShowMessage(Letter+' is NOT in the alphabet');
Show full unit code
   G is in the alphabet
   1 is NOT in the alphabet
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page