ДT
Size: a a a
ДT
RS
ДT
ДT
z
ДT
MО
RS
ДT
z
СП
ДT
MО
ДT
ДT
СП
function TFormMain.CheckVersion(Old, New: string): boolean;
var
OldVersion: array [0..3] of integer;
NewVersion: array [0..3] of integer;
begin
OldVersion[0] := StrToInt(ExtractWord(1, Old, ['.']));
OldVersion[1] := StrToInt(ExtractWord(2, Old, ['.']));
OldVersion[2] := StrToInt(ExtractWord(3, Old, ['.']));
OldVersion[3] := StrToInt(ExtractWord(4, Old, ['.']));
NewVersion[0] := StrToInt(ExtractWord(1, New, ['.']));
NewVersion[1] := StrToInt(ExtractWord(2, New, ['.']));
NewVersion[2] := StrToInt(ExtractWord(3, New, ['.']));
NewVersion[3] := StrToInt(ExtractWord(4, New, ['.']));
Далее ГУГЛ мне дает не очень изящные решения, на мой взгляд. Мб есть уже проверенное в бою решение?RS
function TFormMain.CheckVersion(Old, New: string): boolean;
var
OldVersion: array [0..3] of integer;
NewVersion: array [0..3] of integer;
begin
OldVersion[0] := StrToInt(ExtractWord(1, Old, ['.']));
OldVersion[1] := StrToInt(ExtractWord(2, Old, ['.']));
OldVersion[2] := StrToInt(ExtractWord(3, Old, ['.']));
OldVersion[3] := StrToInt(ExtractWord(4, Old, ['.']));
NewVersion[0] := StrToInt(ExtractWord(1, New, ['.']));
NewVersion[1] := StrToInt(ExtractWord(2, New, ['.']));
NewVersion[2] := StrToInt(ExtractWord(3, New, ['.']));
NewVersion[3] := StrToInt(ExtractWord(4, New, ['.']));
Далее ГУГЛ мне дает не очень изящные решения, на мой взгляд. Мб есть уже проверенное в бою решение?ДT
СП
for j := 0 to 3 do
OldVersion[j] := StrToInt(ExtractWord(j + 1, Old, ['.']));
for j := 0 to 3 do
NewVersion[j] := StrToInt(ExtractWord(j + 1, New, ['.']));
RS
function TFormMain.CheckVersion(Old, New: string): boolean;
var
OldVersion: array [0..3] of integer;
NewVersion: array [0..3] of integer;
begin
OldVersion[0] := StrToInt(ExtractWord(1, Old, ['.']));
OldVersion[1] := StrToInt(ExtractWord(2, Old, ['.']));
OldVersion[2] := StrToInt(ExtractWord(3, Old, ['.']));
OldVersion[3] := StrToInt(ExtractWord(4, Old, ['.']));
NewVersion[0] := StrToInt(ExtractWord(1, New, ['.']));
NewVersion[1] := StrToInt(ExtractWord(2, New, ['.']));
NewVersion[2] := StrToInt(ExtractWord(3, New, ['.']));
NewVersion[3] := StrToInt(ExtractWord(4, New, ['.']));
Далее ГУГЛ мне дает не очень изящные решения, на мой взгляд. Мб есть уже проверенное в бою решение?function CompareVersions(const aVersion1, aVersion2: TFileProductVersion): Integer;
begin
Result:=aVersion1[0]-aVersion2[0];
if Result=0 then
Result:=aVersion1[1]-aVersion2[1]
else
Exit;
if Result=0 then
Result:=aVersion1[2]-aVersion2[2]
else
Exit;
if Result=0 then
Result:=aVersion1[3]-aVersion2[3];
end;
Но тут уже версия это массив из четерых типа Word
TFileProductVersion = array[0..3] of word;