delphi4arab منتديات دلفي للعرب
كيف احول ال hex الى decimal - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : كيف احول ال hex الى decimal (/showthread.php?tid=9179)



كيف احول ال hex الى decimal - jeanjamil - 13-02-2018

السلام عليكم
كيف احول ال hex الموجود بهذا الشكل
 4D 54 68 64 00 00 00 06 00 01 00 04 00 F0 4D 54 
الى decimal خانة تلو الاخرى مع الحفاظ على الفراغات
اي
... 104 84 77


RE: كيف احول ال hex الى decimal - Agmcz - 13-02-2018

وعليكم السلام
هكذا
PHP كود :
function HexTo_(Str: string): string;
var
  
I: Integer;
begin
  Result 
:= '';
  
Str := StringReplace(Str, ' ', '', [rfReplaceAll]);
  for 
I := 1 to Length(Str) do
  
begin
    
if I mod 2 = 0 then
      Result 
:= Result + ' ' + IntToStr(StrToInt(HexDisplayPrefix + Str[I-1] + Str[I]));
  
end;
end; 



RE: كيف احول ال hex الى decimal - AX302 - 13-02-2018

السلام عليكم
كاضافة الى اجابة الاخ فوق يمكنك ايضا هكدا  
كود :
procedure TForm1.Button1Click(Sender: TObject); const MyHex : Array of Byte = [$4D,$54,$68,$64,$00,$00,$00,$06,$00,$01,$00,$04,$00,$F0,$4D,$54]; var   i:integer; Result:string; begin for  i:= Low(MyHex) to High(MyHex) do  begin   Result := Result +' '+ (IntToStr(MyHex[i]));  end;  ShowMessage(Result); end;