
function Compare(const s1, s2: String): ShortInt;
var
n, m, i: Byte;
begin
n := Length(s1);
m := Length(s2);
i := 1;
while (i <= n) and (i <= m) and (s1[i] = s2[i]) do inc(i);
if ((i > n) and (i <= m)) or ((i <= n) and (i <= m) and (s1[i] < s2[i])) then Compare := -1
else
if ((i > m) and (i <= n)) or ((i <= n) and (i <= m) and (s1[i] > s2[i])) then Compare := 1
else Compare := 0;
end;