未声明的标识符:'PosEx'

3

我尝试在我的Delphi 2007程序中使用这段代码

function ExtractText(const Str: string; const Delim1, Delim2: string): string;
var
  pos1, pos2: integer;
begin
  result := '';
  pos1 := Pos(Delim1, Str);
  if pos1 > 0 then begin
    pos2 := PosEx(Delim2, Str, pos1+1);
    if pos2 > 0 then
      result := Copy(Str, pos1 + 1, pos2 - pos1 - 1);
  end;
end;  

我在谷歌上搜索后发现需要下载“FastCode.Libraries-0.6.4.zip”,我已经下载了它,但不知道如何使用它来使上面的代码工作。请帮忙!


4
错误在哪里?是因为未声明的标识符吗?你的uses中是否有StrUtils - Martin Melka
1个回答

7

PosEx在StrUtils单元中定义。请确保在uses子句中包含它。


1
非常感谢大家,我已经将StrUtils添加到uses中,问题解决了。当我看到StrUtils时,我以为它是SysUtils,我想我应该买眼镜xD。 - beingbad

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接