unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
set1: set of Char; {定义一个字符集合变量}
c: Char; {定义个字符用于遍历集合}
num: Integer; {用于计数}
begin
set1 := ['a'..'z', 'A'..'Z', '0'..'9']; {给集合赋值}
num := 0;
for c in set1 do Inc(num); {遍历字符集合 set1, 让 num 计数}
ShowMessage(IntToStr(num)); {62}
end;
end.
问题来源:
http://www.cnblogs.com/del/archive/2008/05/11/978683.html#1191835
转载于:https://my.oschina.net/hermer/blog/319921