提示:ambiguous overloaded call to StrLIComp,如何修改?

kerbcurb 2011-01-11 09:36:24
function SameText(const S1, S2: shortString): Boolean;
var
L: Integer;
begin
L := Length(S1);
Result := (L = Length(S2)) and (StrLIComp(@S1[1], @S2[1], L) = 0);
end;
编译通不过,提示:ambiguous overloaded call to StrLIComp,如何修改?
...全文
344 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
kerbcurb 2011-01-12
  • 打赏
  • 举报
回复
谢谢楼上两位,我对pascal不熟
bdmh 2011-01-12
  • 打赏
  • 举报
回复
你是2010的,2010对StrLIComp有两个重载,参数为PWideChar,所以你需要指明传递的是哪种类型,改一下

function SameText(const S1, S2: shortString): Boolean;
var
L: Integer;
begin
L := Length(S1);
Result := (L = Length(S2)) and (StrLIComp(PAnsiChar(@S1[1]), PAnsiChar(@S2[1]), L) = 0);
end;
hongqi162 2011-01-12
  • 打赏
  • 举报
回复
你的开发工具是那个版本,delphi7是没有问题的

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧