mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 17:40:28 +02:00
* CompareStr, needed for Sort routines
git-svn-id: trunk@3981 -
This commit is contained in:
parent
a3a74c3fbe
commit
c7401a1d80
@ -91,7 +91,8 @@ interface
|
|||||||
and false is returned.
|
and false is returned.
|
||||||
}
|
}
|
||||||
function DePascalQuote(var s: string): Boolean;
|
function DePascalQuote(var s: string): Boolean;
|
||||||
function CompareText(S1, S2: string): longint;
|
function CompareStr(const S1, S2: string): Integer;
|
||||||
|
function CompareText(S1, S2: string): integer;
|
||||||
|
|
||||||
{ releases the string p and assignes nil to p }
|
{ releases the string p and assignes nil to p }
|
||||||
{ if p=nil then freemem isn't called }
|
{ if p=nil then freemem isn't called }
|
||||||
@ -861,17 +862,28 @@ uses
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function CompareText(S1, S2: string): longint;
|
function CompareStr(const S1, S2: string): Integer;
|
||||||
|
var
|
||||||
|
count, count1, count2: integer;
|
||||||
|
begin
|
||||||
|
result := 0;
|
||||||
|
Count1 := Length(S1);
|
||||||
|
Count2 := Length(S2);
|
||||||
|
if Count1>Count2 then
|
||||||
|
Count:=Count2
|
||||||
|
else
|
||||||
|
Count:=Count1;
|
||||||
|
result := CompareChar(S1[1],S2[1], Count);
|
||||||
|
if result=0 then
|
||||||
|
result:=Count1-Count2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function CompareText(S1, S2: string): integer;
|
||||||
begin
|
begin
|
||||||
UpperVar(S1);
|
UpperVar(S1);
|
||||||
UpperVar(S2);
|
UpperVar(S2);
|
||||||
if S1<S2 then
|
Result:=CompareStr(S1,S2);
|
||||||
CompareText:=-1
|
|
||||||
else
|
|
||||||
if S1>S2 then
|
|
||||||
CompareText:= 1
|
|
||||||
else
|
|
||||||
CompareText:=0;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user