![]() |
Case of komrpimieren
Hi,
wie ging das gleich noch, wenn man nicht alles tippen will?
Delphi-Quellcode:
Ich habe keine Lust von 0 - 61 alles hinzuschreiben. Hatte schonmal eine kürzere Möglichkeit gelesen, aber wie ging die noch gleich? :lol:
case Random(62) of
0: S := 'A'; 1: S := 'B'; ... 26: S := 'a'; 27: S := 'b'; ... 52: S := '0'; 53: S := '1'; ... end; |
Re: Case of komrpimieren
|
Re: Case of komrpimieren
Du kannst da was zusammenfassen:
Delphi-Quellcode:
Schau dir dazu mal die Werte in der ASCII-Tabelle an. ;)
Zahl := Random(62);
case Zahl of 0..25: S := Char(Zahl + ASCII-Wert); 26..51: S := Char(Zahl + ASCII-Wert); 52..61: S := Char(Zahl + ASCII-Wert); end; |
Re: Case of komrpimieren
Du könntest auch mit einem Array arbeiten.
Delphi-Quellcode:
const
chars: array[0..61] of char = ('A','B','C','D',...,'a','b',...,'0','1,'2'...); ... char = chars[random(62)]; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz