在Delphi中将枚举值转换为整数 [英] Cast Enumeration Value to Integer in Delphi

查看:244
本文介绍了在Delphi中将枚举值转换为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Delphi中将枚举值转换/转换为Integer?

Is it possible to cast/convert an Enumeration Value to Integer in Delphi?

如果是,那么如何?

推荐答案

明确地在有关枚举类型的文档中

几个预定义函数对序数值和类型标识符起作用。以下是其中最重要的摘要。

Several predefined functions operate on ordinal values and type identifiers. The most important of them are summarized below.


| Function |                       Parameter                       |                      Return value | Remarks                                           |
|----------|:-----------------------------------------------------:|----------------------------------:|---------------------------------------------------|
| Ord      |                   Ordinal expression                  |  Ordinality of expression's value | Does not take Int64 arguments.                    |
| Pred     |                   Ordinal expression                  | Predecessor of expression's value |                                                   |
| Succ     |                   Ordinal expression                  |   Successor of expression's value |                                                   |
| High     | Ordinal type identifier or   variable of ordinal type | Highest value in type             | Also operates on short-string   types and arrays. |
| Low      | Ordinal type identifier or   variable of ordinal type | Lowest value in type              | Also operates on short-string   types and arrays. |

这篇关于在Delphi中将枚举值转换为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆