您的位置:首页 > 编程语言 > Delphi

Delphi7遍历枚举,子界

2020-02-29 19:52 375 查看

Delphi2009或者其他的语言说道遍历不是for..in就是直接foreach,Delphi7如何遍历呢?

一、遍历枚举

1 //需要引用TpyInfo单元
2 Type
3     TImageType = (jpg,gif,png,bmp,tif,psd);
4
5 var
6     image:TImageType;
7     i:Integer;
8 begin
9     i := 0;
10     for image:= Low(TImageType) to High(TImageType) do
11     begin
12         TpyInfo.GetEnumName(TypeInfo(TImageType),i);
13         Inc(i);
14     end;
15 end;

二、遍历子界

1 Type
2    Uppercase = 'A'..'Z';
3
4 var
5    UppLetter:Uppercase;
6 begin
7     for UppLetter:= Low(Uppercase) to High(Uppercase) do
8     begin
9         ShowMessage(UppLetter);
10    end;
11 end;

转载于:https://www.cnblogs.com/kiny/articles/2676628.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
b644352184372385 发布了0 篇原创文章 · 获赞 0 · 访问量 145 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: