14-06-2012
|
|
Moderador
|
|
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.077
Reputación: 10
|
|
O esto con 'in':
Cita:
In
Example code : Determine whether a character is a letter begin
IsLetter('G'); // G is a letter of the (uppercase) alphabet
IsLetter('1'); // 1 is not a letter
end;
// Test if a character is a letter
procedure TForm1.IsLetter(Letter : char);
var
Alphabet : set of 'A'..'Z';
begin
Alphabet := ['A'..'Z'];
if Letter In Alphabet then
ShowMessage(Letter+' is in the alphabet')
else
ShowMessage(Letter+' is NOT in the alphabet');
end;
Show full unit code G is in the alphabet
1 is NOT in the alphabet
Ordinal expression in Set expression
Description The In keyword tests whether a value is in a set. It returns true if it is, false if not.
Notes 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.
|
|