Autor Beitrag
Nano-Ware
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Sa 13.02.10 19:06 
Hi,

ich hätte gerne, dass mein Programm in einer Konsole die Buchstaben A-Z anzeigt. Ich möchte das mit einer Schleife lösen. Ich suche irgendeine Funktion, die z.B. wenn ich 1 übergebe A zurückgibt 2 = B usw es kann natürlich auch andere Zahlen sein, allerdings müsste A von B, B von C .... immer 1 entfernt sein^^

Ich hoffe ihr versteht was ich mein ;) Vielen Dank im Vorraus
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.02.10 19:27 
Schau dir einfach mal Chr an. ;-)
Nano-Ware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Sa 13.02.10 19:36 
Das suchte ich! Nur wo fängt das A an? also welche Zahl hat A,B,C,.....,X,Y,Z?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Sa 13.02.10 19:39 
Das bekommst du über die Umkehrfunktion Ord raus ;) .
Wobei es äußerst unschön wäre, den ASCII-Code fest in den Quelltext zu schreiben, lass die Schleife einfach von Ord('A') bis Ord('Z') laufen.

_________________
>λ=
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.02.10 19:40 
Und ansonsten:
Suche bei Google ASCII TABELLE
Nano-Ware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Sa 13.02.10 19:42 
Yaa das ist ja mein Problem^^

wie lass ich denn eine Schleife von A-Z laufen. Währe nett wenn ihr den Code posten könntet^^ ich weiß das geht mit ner For Schleife aber wie?????
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 13.02.10 19:59 
user profile iconNano-Ware hat folgendes geschrieben Zum zitierten Posting springen:
wie lass ich denn eine Schleife von A-Z laufen.

Zum Beispiel so: :mrgreen:
ausblenden Delphi-Quelltext
1:
for c := 'A' to 'Z' do // var c: Char;					

Ansonsten beschäftige Dich am besten auch mit der Gegenfunktion von Chr(), Ord(). ;)
Nano-Ware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Sa 13.02.10 20:11 
^^ yaaa^^ ich habs bis jetzt halt noch nie gebraucht^^
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.02.10 20:32 
Und wenn es auch unzusammenhängende Zeichenbereiche sein sollen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var
  c: Char;
begin
  for c in ['A'..'Z''ä''ö''ü'do
    ShowMessage(c);
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Sa 13.02.10 21:29 
geht aber afaik nur unter Versionen > Delphi 2009. ;)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 14.02.10 08:29 
Nein, wie andere Spracherweiterungen geht das ab Delphi 2006 / Turbo Delphi. Mit Delphi 2005 kam die neue IDE, mit Delphi 2006 dazu die Stabilität und einige Spracherweiterungen. ;-)