如何使用TCharHelper?

Arn*_*old 8 delphi char delphi-xe5

下一个代码:

function get_symbol (var s: String): String;
var c: Char;
    p: Int32;
begin
// ... some more code ...
   c := upcase (s [p]);
   if IsDigit (c) then
Run Code Online (Sandbox Code Playgroud)

导致以下错误消息:

[dcc32 Warning] fmx_utilities_string.pas(188): W1000 Symbol 'IsDigit' is deprecated: 'Use TCharHelper'

我不理解这条消息,因为包含了System.Character,c被声明为Char,而TCharhelper被声明为Char的字符助手.我究竟做错了什么?

Ken*_*ite 9

你没有使用TCharHelper ; 你正在使用旧的System.Character IsDigit函数.使用方法TCharHelper.IsDigit是:

if c.IsDigit then
  ...
Run Code Online (Sandbox Code Playgroud)