Autor Beitrag
Anja
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN xp

BeitragVerfasst: Mo 02.06.03 10:29 
Ich brauche dringend Hilfe,

kann mir jemand den Quellcode schicken zur Umwandlung von Hexa in Dez.

Danke Anja
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Function  HexToDez(hexZahl:string):string;

var
    i           : integer;
   erg          : integer;
   Zahl,wert    : integer;

 const
    symbole='0123456789ABCDEF';
begin

     erg:= 0 ;

     for i:=length(hexzahl) downto 1 do

             begin
                   wert:=Ansipos(Symbole,hexZahl[i])-1;
                   Zahl:=StrToInt(copy(hexZahl,length(hexZahl)-i+1,1));
                    erg:= wert*real(16,length(hexZahl)+i)+erg;
             end;

           result:=IntTostr(erg)


end;

das ist mein beispiel aber es funktioniert net richtig!

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mo 02.06.03 10:45 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function HexToDez(hexZahl:string):string;
begin
  result := StrToInt('$'+hexzahl);
end;


oder einfach nur StrToInt('$'+hexzahl);

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mo 02.06.03 10:47 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Function HexStrToInt(s1:String):Integer; 
Var d1:Cardinal; b1:Byte; i:Integer; 
Begin 
  d1 := 0; 
  For i := 1 to Length(s1) do Begin 
    If s1[i] <> ' ' Then Begin 
      d1 := d1 shl 4; 
      b1 := Ord((s1[i])) - 48; 
      If b1 > 41 Then b1 := b1 - 32; 
      If b1 > 9 Then b1 := b1 - 7; 
      d1 := d1 or b1; 
    End; 
  End; 
  Result := d1; 
End;


alternative Lösung (home.t-online.de/hom...ities/Utilities.html)

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.