CONVERTIR UNE CHAINE DE CARACTÈRE EN CODE ASCII

f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 - 24 juil. 2006 à 17:44
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 - 24 juil. 2006 à 17:56
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/38761-convertir-une-chaine-de-caractere-en-code-ascii

f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
24 juil. 2006 à 17:56
var
TC : array of char;
BC : array of byte;

procedure TCtoBC;
begin
SetLength(BC,Length(TC));
Move(TC,BC,SizeOf(TC));
end;

procedure BCtoTC;
begin
SetLength(TC,Length(BC));
Move(BC,TC,SizeOf(BC));
end;

var i : byte;
begin
SetLength(BC,255);
for i := 1 to 255 do BC[i-1] := i;
BCtoTC;
for i := 0 to 255 do begin
writeln(TC[i]+' : #'+inttostr(BC[i]));
end;

ça vas un chouilla plus vite aussi.
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
24 juil. 2006 à 17:44
a la bourrin :

begin
S := 'Merci de ne pas poster 15000 codes sources le meme jours';

for i := 1 to length(s) do begin
SAscii := SAscii + inttostr(Ord(S[i]));

Writeln(S);
end;
Rejoignez-nous