字符串函数
function XXXCompareText(const S1, S2: string): Integer;
Begin
Result := CompareString(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, Pchar(s1), Length(s1), Pchar(s2), Length(s2)) - 2;
end;
function XXXSameStr(const S1, S2: string): Boolean;
begin
Result := XXXCompareText(S1, S2) = 0;
end;
function AnsiIndexStr(const AText: string;
const AValues: array of string): Integer;
var
i: Integer;
Begin
Result := -1;
for i := low(AValues) to high(AValues) do
Begin
if XXXSameStr(AText, AValues[i]) then
Begin
Result := I;
break;
end;
end;
end;
function AnsiStrComp(S1, S2: String): Integer;
begin
Result := CompareString(LOCALE_USER_DEFAULT, 0, Pchar(s1), -1, Pchar(s2), -1) - 2;
end;
function XXXIndexStr(const AText: string;
const AValues: array of string): Integer;
var
i: Integer;
Begin
Result := -1;
for i := low(AValues) to high(AValues) do
Begin
if XXXSameStr(AText, AValues[i]) then
Begin
Result := I;
break;
end;
end;
end;
function XXXMatchStr(const AText: string;
const AValues: array of string): Boolean;
begin
Result := XXXIndexStr(AText, AValues) <> -1;
end;
function AnsiStrComp(S1, S2: String): Integer;
begin
Result := CompareString(LOCALE_USER_DEFAULT, 0, Pchar(s1), -1, Pchar(s2), -1) - 2;
end;