Changer les caractères en nombres

Résolu
ABDE83 Messages postés 5 Date d'inscription samedi 3 mars 2018 Statut Membre Dernière intervention 7 mars 2018 - Modifié le 3 mars 2018 à 17:43
korgis Messages postés 420 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 6 mai 2019 - 13 mars 2018 à 14:57
Je suis un débutant en programmation Delphi
Un petit programme où vous changez les caractères en nombres
Par exemple, 'X' = 0 ; 'M' = 1 ; 'R' = 2 ; 'U' = 3 ; 'O' = 4.
Quand j'écris 'MORXX le résultat est 14200
S'il vous plaît aider avec ce programme et merci d'avance
Ce programme est-il vrai?

procedure TForm1.Button1Click(Sender: TObject); 
var 

shortStr : shortstring; 
i,j : Integer; 

begin 
j:=0; 
Label1.Caption:=''; 
shortStr:=edit1.Text; 
for i := 1 to length(shortStr) do begin 

case Length(shortStr) of 
9: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
8: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
7: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
6: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
5: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 

4: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
3: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
2: 
begin 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
end; 
1: 
BEGIN 
if shortStr[i] = 'X' then 
BEGIN 
J:= 0; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'M' then 
BEGIN 
J:= 1; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'R' then 
BEGIN 
J:= 2; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'U' then 
BEGIN 
J:= 3; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'O' then 
BEGIN 
J:= 4; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'N' then 
BEGIN 
J:= 5; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
///////////// 
ELSE 
if shortStr[i] = 'E' then 
BEGIN 
J:= 6; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'G' then 
BEGIN 
J:= 7; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'L' then 
BEGIN 
J:= 8; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END 
ELSE 
///////////// 
if shortStr[i] = 'A' then 
BEGIN 
J:= 9; 
Label1.Caption:=Label1.Caption+(inttostr(J)); 
END; 
END; 
END; 

end; 

end;

4 réponses

NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
3 mars 2018 à 17:45
Code illisible (non indenté).
Code redondant (factorisation)
Je ne fais pas de Delphi, mais ça c'est de problème évidents.

Ensuite, pour savoir si ton code est bon, essayes-le.
0
ABDE83 Messages postés 5 Date d'inscription samedi 3 mars 2018 Statut Membre Dernière intervention 7 mars 2018
3 mars 2018 à 23:11
Le programme fonctionne bien
Cherchez un raccourci ou une autre méthode si possible pour ne pas être répétitif
0
korgis Messages postés 420 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 6 mai 2019 17
4 mars 2018 à 00:26
waouhhhh ! lol

procedure TForm1.Button1Click(Sender: TObject);
const
  Letters = 'XMRUONEGLA';
  Numbers = '0123456789';
var
  ShortStr: ShortString;
  i, j: Integer;
  P: Byte;
begin
  j := 0;
  Label1.Caption := '';
  ShortStr := Edit1.Text;
  if Length(ShortStr) > 9 then Exit;
  for i := 1 to Length(ShortStr) do
  begin
    P := Pos(ShortStr[i], Letters);
    if P > 0 then
      Label1.Caption := Label1.Caption + Numbers[P];
  end;
end;

0
ABDE83 Messages postés 5 Date d'inscription samedi 3 mars 2018 Statut Membre Dernière intervention 7 mars 2018
4 mars 2018 à 10:13
Bonjour Mr. korgis
'waouhhhh ! lol '
hhhhh
Excellent travail
Merci beaucoup
0
korgis Messages postés 420 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 6 mai 2019 17
4 mars 2018 à 13:27
Avec plaisir, Mr Abde.
Et merci pour l'appréciation ;-)
0
Cirec Messages postés 3833 Date d'inscription vendredi 23 juillet 2004 Statut Modérateur Dernière intervention 18 septembre 2022 50
5 mars 2018 à 15:21
Bonjour,

juste pour le fun et je sais que l'ami Korgis appréciera également ;)
Ami que je salue au passage ^^
procedure TForm1.Button1Click(Sender: TObject);
const
  ltrArray: array['A'..'Z'] of Char = ('9', 'B', 'C', 'D', '6', 'F', '7', 'H', 'I', 'J',
                                   'K', '8', '1', '5', '4', 'P', 'Q', '2', 'S', 'T',
                                   '3', 'V', 'W', '0', 'Y', 'Z');
var
  I: Integer;
begin
  Label1.Caption := '';
  for I := 1 to Length(Edit1.Text) do
    if Edit1.Text[I] in ['A'..'Z'] then
      Label1.Caption := Label1.Caption + ltrArray[Edit1.Text[I]]
    else
      Label1.Caption := Label1.Caption + Edit1.Text[I];
end;

du coup plus de limitations
Cordialement,

0
korgis Messages postés 420 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 6 mai 2019 17
5 mars 2018 à 17:26
Oui, oui, j'apprécie !

Salut Cirec,

C'est toujours un plaisir de lire tes codes, et tu nous montre une intéressante manière d'interpréter le sujet.
Ça me rappelle le bon vieux temps où on trouvait mille et une variations autour d'un même thème.

Je n'ai pas compris l'intérêt du travail de notre ami ABDE83, mais d'après le code qu'il nous présente, et après l'avoir testé, j'avais déduit que :
- le ShortString ne doit pas dépasser 9 caractères (ni 8, ni 7, ni 6, ni 5, etc... lol) ;
- les caractères 'X','M','R','U','O','N','E','G','L','A' sont à remplacer par un caractères représentant respectivement ces valeurs : 0,1,2,3,4,5,6,7,8,9 ;
- les autres caractères ne sont pas pris en compte.

Du coup, en utilisant ta méthode, si l'on veut respecter strictement ce cahier des charges, ça pourrait donner ceci :

procedure TForm1.Button1Click(Sender: TObject);
const
  ltrArray: array['A'..'Z'] of Char = ('9', 'B', 'C', 'D', '6', 'F', '7', 'H', 'I', 'J',
                                   'K', '8', '1', '5', '4', 'P', 'Q', '2', 'S', 'T',
                                   '3', 'V', 'W', '0', 'Y', 'Z');
  CharToShift = ['X','M','R','U','O','N','E','G','L','A']; // les caractères à modifier, les autres seront négligés
var
  I: Integer;
begin
  Label1.Caption := '';
  if Length(Edit1.Text) > 9 then Exit; // longueur maxi
  for I := 1 to Length(Edit1.Text) do
    if Edit1.Text[I] in CharToShift then
      Label1.Caption := Label1.Caption + ltrArray[Edit1.Text[I]];
end;


Sinon, je vois que j'ai laissé une ligne inutile (la 1ère) dans mon code précédent, à rectifier :
j := 0; // ne sert à rien, déclaration de la variable "J" inutile également

Bonne fin d'aprèm', amicalement,

korgis aka japee
0
korgis Messages postés 420 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 6 mai 2019 17
5 mars 2018 à 20:42
Quand même, le
array['A'..'Z'] of Char
, c'est balaise !
0
ABDE83 Messages postés 5 Date d'inscription samedi 3 mars 2018 Statut Membre Dernière intervention 7 mars 2018
6 mars 2018 à 10:38
Bonjour
Merci pour les réponses
- les caractères 'X','M','R','U','O','N','E','G','L','A' sont à remplacer par un caractères représentant respectivement ces valeurs : 0,1,2,3,4,5,6,7,8,9 ;
- les autres caractères ne sont pas pris en compte.
Pouvez-vous taper en majuscules et minuscules sont le même résultat
- Message d'erreur dans d'autres lettres
0
dubois77 Messages postés 675 Date d'inscription jeudi 17 avril 2008 Statut Membre Dernière intervention 19 février 2019 14
Modifié le 7 mars 2018 à 15:03
procedure TForm1.Button1Click(Sender: TObject);
const
  ltrArray: array['A'..'Z'] of Char = ('9', 'B', 'C', 'D', '6', 'F', '7', 'H', 'I', 'J',
                                   'K', '8', '1', '5', '4', 'P', 'Q', '2', 'S', 'T',
                                   '3', 'V', 'W', '0', 'Y', 'Z');
var
  I: Integer; Z:string;
begin
  Label1.Caption := '';
Z := uppercase(Edit1.Text=;
  for I := 1 to Length(Z) do
    if Z[I] in ['A'..'Z'] 
      then
     Label1.Caption := Label1.Caption + ltrArray[Z[I]]
    else
      MessageDlg('Erreur, caractère ' = Z[i] =' incompatible',mtInformation,[mbOk],0);
end;
0
Cirec Messages postés 3833 Date d'inscription vendredi 23 juillet 2004 Statut Modérateur Dernière intervention 18 septembre 2022 50 > korgis Messages postés 420 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 6 mai 2019
7 mars 2018 à 15:25
Quand même, le
array['A'..'Z'] of Char
,
c'est balaise !

Tu trouves !!!
c'est pas l'idée du siècle non plus ^^

petite question: as tu un IDE supérieur ou égale à D2009 ?
si je me permets de te demander c'est bien sur en rapport avec du code, pour savoir si tu peux profiter des avancées du compilateur ;)
je rappelle au passage que la dernière version de l'IDE était (est ?) en téléchargement gratuit :p

sur ce ... bonne fin de journée et à très bientôt ... j'espère ^^

Amicalement,
@+
0
ABDE83 Messages postés 5 Date d'inscription samedi 3 mars 2018 Statut Membre Dernière intervention 7 mars 2018
Modifié le 7 mars 2018 à 15:03
merci Mr. dubois77

Un léger changement si c'est vrai

procedure TForm1.Edit1Change(Sender: TObject);
  const
  ltrArray: array['A'..'Z'] of Char = ('9', 'B', 'C', 'D', '6', 'F', '7', 'H', 'I', 'J',
                                   'K', '8', '1', '5', '4', 'P', 'Q', '2', 'S', 'T',
                                   '3', 'V', 'W', '0', 'Y', 'Z');
var
  I: Integer; Z:string;
begin
IF edit1.GetTextLen<> 0 then
begin
  Label1.Caption := '';
Z := uppercase(Edit1.Text);
  for I := 1 to Length(Z) do
    if Z[I] in ['X','M','R','U','O','N','E','G','L','A']
      then
     Label1.Caption := Label1.Caption + ltrArray[Z[I]]
    else
     MessageDlg('Erreur, caractère ' + Z[i] +' incompatible',mtInformation,[mbOk],0);
END;
end;
0
dubois77 Messages postés 675 Date d'inscription jeudi 17 avril 2008 Statut Membre Dernière intervention 19 février 2019 14
7 mars 2018 à 17:57
bien vu
(en fait j'ai recopié et modifié le code plus haut sans vérifier correctement !)
0
Rejoignez-nous