Ordinal type 的操作及Delphi System 提供的编译期函数

Delphi Sysem提供的编译期函数

(Dec,Inc,Pred,Succ,Ord,Chr,Low,High,Sizeof)

Dec:将参数的值递减1或一个特定的值,其中特定值可在第二个可选参数中定义。

Inc:将例程中参数的值递增1或一个特定的值

Odd:如果参数为奇数则返回 真。

Pred:根据参数在其数据类型定义中的序列,返回参数值的前驱值。

Succ:返回参数的后继值。

Ord:返回参数值在其数据类型值集合中的序号

Chr:取得 Ascll码对应的字符。

Low:返回参数对应的有序数据类型的最小值。

 

 

Ordinal types include integer,character,Boolean,enumerated,and subrange types.

Several predefined functions operate on ordinal values and type identifiers.

Hiah,Low,Pred,Succ,Ord

使用举例如下

代码如下:

procedure TForm1.Button1Click(Sender:TObject);

begin

    edit1.Text:=pred('b');

    edit2.Text:=inttostr(succ(5));

    edit3.Text:=inttostr(high(Byte));

end;

 

posted @ 2016-07-27 18:29  心如止氺  阅读(159)  评论(0编辑  收藏  举报