Autor Beitrag
Teppichkleber
Hält's aus hier
Beiträge: 14

Win XP, Win 2000
D7 Prof
BeitragVerfasst: Sa 04.06.05 10:37 
Hallo zusammen,

ich hoffe Ihr könnt mir mal wieder helfen.
Ich habe jetzt schon eine ganze weile experimentiert, aber ich bekomme es einfach nicht hin, 2 hexzahlen zu verketten.
Beispiel:
1. Hexwert
15h
2. Hexwert
Eh
Gewünschtes Ergebnis: 15Eh

Ich bekomme die Werte leider immer nur addiert und dann ist das Ergebnis 23h und das ist nicht das was ich benötige.

Vielen Dank für eure Hilfe
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 04.06.05 10:43 
Du musst es erst als String "umkonvertieren". Dann zusammensetzen und dann wieder zurück. Wenn du mir den Code gibst, kann ich's dir zeigen. ;)
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 04.06.05 10:45 
Du rechnest einfach:
(1. Hexwert)*$100+(2. Hexwert)
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 04.06.05 11:41 
user profile icondelfiphan hat folgendes geschrieben:
Du rechnest einfach:
(1. Hexwert)*$100+(2. Hexwert)

Bin ich dafür zu blöd? :gruebel:

Was ist denn z.B. an dieser Funktion falsch?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function MergeHexValues(MyHexValue1, MyHexValue2: Integer): Integer;
begin
Result := StrToInt(IntToStr(MyHexValue1)+IntToStr(MyHexValue1));
end;
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 04.06.05 12:18 
Du hängst 2 Dezimalzahlen als Strings aneinander...
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 04.06.05 12:26 
user profile icondelfiphan hat folgendes geschrieben:
Du hängst 2 Dezimalzahlen als Strings aneinander...

:autsch: Stimmmt. Danke. ;)
Teppichkleber Threadstarter
Hält's aus hier
Beiträge: 14

Win XP, Win 2000
D7 Prof
BeitragVerfasst: Mo 06.06.05 21:03 
Danke WeBsPaCe und Danke delfiphan,

Ihr habt mir echt weitergeholfen.
Der Tipp von delphifan war gut.
Ich habe daraus folgenden Code gebaut: (Falls es jemanden Interessiert)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
i:integer;
zahl,zahl2:integer;
mystring:string;
begin
zahl2:=0;
mystring:=edit1.Text;
for i:=length(mystring) downto 1 do
begin
zahl:=ord(mystring[i])-$30;
Zahl2:=Zahl2+Zahl*  round(power(16,i-1));
end;
end;


Nochmals Vielen Dank

Teppichkleber

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.