且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试为字符串实现类助手时为什么会出现E2029错误?

更新时间:2022-11-07 20:53:32

对于字符串类型,您需要使用记录助手而不是 class 助手。

For a string type you need to use a record helper rather than a class helper.

type
  TStringHelper = record helper for string
    ....  
  end;

请注意记录基本数据类型的助手(例如 Integer double string 等)仅在XE3中引入,因此,如果您使用的是旧版本,则可以运气不好。

Note that record helpers for fundamental data types (e.g. Integer, double, string etc.) were only introduced in XE3, so if you have an older version you are out of luck.