Autor Beitrag
Sqall
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 30



BeitragVerfasst: So 20.02.05 19:34 
Hi

Kenn jemand von euch eine function oder ähnliches wo ich einen buchstaben als parameter übergeben kann und dieser mir den binär werd dieses buchstabens bzw zeichens gibt. Dieser müsste natürlich 8bit besitzen. Oder muss ich mir selber so etwas programmieren?

_________________
Bones... Promises... Both breakes
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: So 20.02.05 19:36 
Standardmäßig hat Delphi keine mir bekannte Funktion, die das kann.
Da wirst du wohl selbst drangehen müssen.
Gast
Gast
Erhaltene Danke: 1



BeitragVerfasst: So 20.02.05 19:37 
Als Parameter wodran und wofür? Und meinst du, du kannst auch ein wenig weniger 8) Rechtschreibfehler machen.
Sqall Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 30



BeitragVerfasst: So 20.02.05 19:53 
Ich meine als parameter für die funktion xyz:

xyz(a) -> gibt 8stelligen binärwert zurück

Was denkst du denn was ich als parameter meine? Das was ein parameter ist. Also will ich im prinzip eine funktion wie chr oder ord.

_________________
Bones... Promises... Both breakes
Ich Bins
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 197

Win XP Prof
D5 Prof
BeitragVerfasst: So 20.02.05 20:21 
Ich kenne auch keine solche Funktion, d.h. du musst dir selber eine schreiben. Dazu brauchst du nur den Dezimalwert des jeweiligen Buchstabens (kriegt man über die Ascii-Tabelle raus), und dann nacheinander überprüfen ober die Zahl größer als 128, der Rst größer als 64, 32 etc. ist

_________________
Diese Nachricht wurde mit einer Taschenlampe in das offenliegende Ende eines Glasfaserkabels gemorst!
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 20.02.05 20:33 
Die Funktion Ord ist zu "Ich Bins"' Aussage ein heißer Tipp ;)

AXMD
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 20.02.05 20:35 
Siehe cvs.sourceforge.net/...nclude/OIncProcs.pas bei Funktion ByteToBinary. Aufruf z.B.:

ausblenden Delphi-Quelltext
1:
2:
var C: Char;
Str := ByteToBinary(Ord(C));

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Gast
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 21.02.05 17:40 
Ich hab an Parameter wie z.B. STARTPARAMETER gedacht :)
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mo 21.02.05 17:49 
paramstr / paramcount und dann BenBes methode
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Di 22.02.05 00:49 
Weniger effizient als die Funktion in der Unit weiter oben, aber hiermit kannst du ne beliebige Basis wählen. Binär, Oktal, Hex, ...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function chgbase(a : cardinal) : string;
const
 Base = 2;
var
 b : byte;
begin
 Result := '';
 repeat
  b := a mod Base;
  if (Base>9and (b>9then
   inc(b, byte('A')-byte('0')-10);
  Result := char(byte('0')+b) + Result;
  a := a div Base;
 until a=0;
end;

In deinem Fall beispielsweise mit chgbase(ord('A'))