【发布时间】:2020-05-03 19:20:11
【问题描述】:
我在 Delphi 10.3.3 中使用了这个功能:
function StrTrimCharsLeft(const S: string; const Chars: array of Char): string;
var
I, L: SizeInt;
begin
I := 1;
L := Length(S);
while (I <= L) and ArrayContainsChar(Chars, S[I]) do
Inc(I);
Result := Copy(S, I, L - I + 1);
end;
当我以这种方式使用该函数时,我得到一个错误:
[dcc32 错误]: E2250 没有可以使用这些参数调用的“StrTrimCharsLeft”的重载版本
const
BomChars = ['ï', '»', '¿'];
...
s := JclStrings.StrTrimCharsLeft(s, BomChars);
但是当我以这种方式使用它时,一切正常而没有错误:
s := JclStrings.StrTrimCharsLeft(s, ['ï', '»', '¿']);
那么如何定义和使用Char 的数组作为常量呢?
【问题讨论】:
标签: arrays delphi constants delphi-10.3-rio