mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 00:29:25 +02:00
* Implemented CompareWideString, based on CompareStr
git-svn-id: trunk@10501 -
This commit is contained in:
parent
6910b0ed40
commit
b5454e0352
@ -1971,10 +1971,33 @@ function GenericWideCase(const s : WideString) : WideString;
|
|||||||
unimplementedwidestring;
|
unimplementedwidestring;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CompareWideMemRange(P1, P2: Pointer; Length: cardinal): integer;
|
||||||
|
var i: cardinal;
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
result := 0;
|
||||||
|
while (result=0) and (I<length) do
|
||||||
|
begin
|
||||||
|
result:=Word(P1^)-Word(P2^);
|
||||||
|
P1:=PWideChar(P1)+1; // VP compat.
|
||||||
|
P2:=PWideChar(P2)+1;
|
||||||
|
i := i + 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function CompareWideString(const s1, s2 : WideString) : PtrInt;
|
function CompareWideString(const s1, s2 : WideString) : PtrInt;
|
||||||
|
var count, count1, count2: integer;
|
||||||
begin
|
begin
|
||||||
unimplementedwidestring;
|
result := 0;
|
||||||
|
Count1 := Length(S1);
|
||||||
|
Count2 := Length(S2);
|
||||||
|
if Count1>Count2 then
|
||||||
|
Count:=Count2
|
||||||
|
else
|
||||||
|
Count:=Count1;
|
||||||
|
result := CompareWideMemRange(Pointer(S1),Pointer(S2), Count);
|
||||||
|
if result=0 then
|
||||||
|
result:=Count1-Count2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user