[Setup]
AppName=test
AppVerName=test
DefaultDirName={tmp}
Uninstallable=no
CreateUninstallRegKey=no
OutputDir=.
[Languages]
Name: ru; MessagesFile: compiler:Languages\russian.isl
[Code]
function HexToStr(str_hex: string): Ansistring;
var
i: Integer;
begin
Result:= '';
StringChange(str_hex, ',', '');
StringChange(str_hex, ' ','');// удаляем пробелы
for i:= 1 to Length(str_hex) div 2 do
Result:= Result + Chr(StrToInt('$' + Copy(str_hex, (i-1)*2+1, 2)));
end;
function StrToHex(str: Ansistring): Ansistring;
var
i: Integer;
begin
Result:= '';
for i:= 1 to Length(str) do
Result:= Result + Format('%.2x', [Ord(str[i]), Ord(str[i])]);
end;
function StrToHex2(str: Ansistring): Ansistring; //тут возвращаем пробелы
var
i: Integer;
S: string;
begin
Result:= '';
S := StrToHex(str);
for i:=1 to Length(S) do
if (i mod 2 = 0) then Result:= Result+S[i]+' ' else Result:= Result+S[i];
end;
procedure InitializeWizard;
var
S: string;
begin
S := HexToStr('70 30 FC B7 20 B3 E5 40');
MsgBox(S, mbInformation, MB_OK);
S := StrToHex2(S);
MsgBox(S, mbInformation, MB_OK);
end;