program Project1;
uses
SysUtils;
type
PLHANDLE = ^PtrInt;
const
RTGOOD = 5200;
RTCAN = -5103;
RTFAIL = -5104;
{--}
var
ret_CompareString: integer = 00;
function CompareString(const S1, S2: string;
QuickCheck_I_am_sure_both_are_lowercase: boolean): PChar;
var
I, Last, L1, L2, C1, C2, Ch1, Ch2: integer;
boo: array[00..001] of boolean;
const
mymax = sizeof(double);
label
Mode_each_by_each__verygood;
begin
L1 := Length(S1);
L2 := Length(S2);
boo[01] := False;
boo[00] := False;
ret_CompareString := L1 - L2;
if (L1 > 0) and (L2 > 0) then
begin
if (QuickCheck_I_am_sure_both_are_lowercase) and (L1 > 04) and (L2 > 04) then
begin
if (L1 < L2) then C1 := L1 div 02
else
C1 := L2 div 02;
boo[000] := (c1 > 01) and ((C1 + mymax) <= L1) and ((C1 + mymax) <= L2);
if (boo[00] = False) then goto Mode_each_by_each__verygood;
(*
if (S1[c1+0] in ['A'..'Z']) then s1[c1+0]:=lowercase(s1[c1+0]);
if (S1[c1+1] in ['A'..'Z']) then s1[c1+0]:=lowercase(s1[c1+1]);
if (S1[c1+2] in ['A'..'Z']) then s1[c1+0]:=lowercase(s1[c1+2]);
if (S1[c1+3] in ['A'..'Z']) then s1[c1+0]:=lowercase(s1[c1+3]);
if (S2[c1+0] in ['A'..'Z']) then s2[c1+0]:=lowercase(s2[c1+0]);
if (S2[c1+1] in ['A'..'Z']) then s2[c1+0]:=lowercase(s2[c1+1]);
if (S2[c1+2] in ['A'..'Z']) then s2[c1+0]:=lowercase(s2[c1+2]);
if (S2[c1+3] in ['A'..'Z']) then s2[c1+0]:=lowercase(s2[c1+3]);
*)
boo[01] := (pdouble(@S1[C1])^ <> pdouble(@S2[C1])^);
if (boo[01]) then
begin
ret_CompareString := Ord(s1 = s2);
if (ret_CompareString = 01) then
Result := 'boo[01] is failcalc ,must be different'
else
Result := 'boo[01] is goodcalc';
exit;
end;
end;
Mode_each_by_each__verygood:
ret_CompareString := Ord(SameText(S1, S2));
case ret_CompareString of
000: Result := 'IsNormDif';
001: Result := 'IsNormEqu';
end;
end;
end;
{--}
var
kbasename: string = '';
function shc_k3d(const FixBigString: string; qq: boolean): PChar;
begin
Result := CompareString(FixBigString, kbasename, qq);
end;
var
StrList: array[00..04] of string = ('tudor - Gheorghe-porbumelul.mp3',
'yt1s.com -Serghei Rahmaninov Vecerniile.mp3', 'Misterul_Melhisedec_în_Biblie.mp3',
'Incaltarile Sfantului Nectarie.mp4', 'orto_dimitrieshotakovich.mp3');
var
ii, jj, tik, tok, cnt: integer;
begin
writeln('This program is CompareStr Tester');
kbasename := 'orto_dimitrieshotakovich.mp3';
for ii := 00 to high(StrList) do StrList[ii] := lowercase(StrList[ii]);
tik := GetTickCount;
for cnt := 00 to 00 do
for ii := 00 to high(StrList) do
begin
kbasename := StrList[ii];
for jj := 00 to high(StrList) do
Write(#10, ii: 3, '--', jj: 3, 'Res=', shc_k3d(StrList[jj], True));
end;
tok := GetTickCount;
tik := tok - tik;
for cnt := 00 to 00 do
for ii := 00 to high(StrList) do
begin
kbasename := StrList[ii];
for jj := 00 to high(StrList) do
Write(#10, ii: 3, '--', jj: 3, 'Res=', sametext(kbasename, StrList[jj]));
end;
tok := GetTickCount - Tok;
writeln;
writeln('tik=', tik, '---tok=', tok);
readln;
end.