walid21dz
Messages postés1Date d'inscriptiondimanche 24 avril 2011StatutMembreDernière intervention16 janvier 2012 16 janv. 2012 à 13:42
Merci pour ton code ils est très utile
idiaslema
Messages postés3Date d'inscriptiondimanche 27 juin 2004StatutMembreDernière intervention 7 août 2012 2 mars 2011 à 15:42
bonjour j'ai utilisé ce code il m'a été trés utile Merci, je veux simplement vous demander comment afficher l'arreté en lettre dans plusieurs report qu'on en a une base de données de par exemple 300 enregistrements on a presque 06 pages chaque page a un total et son arrété en lettre.
SVP aidez moi.
MERCI
kachwahed
Messages postés18Date d'inscriptionsamedi 6 décembre 2008StatutMembreDernière intervention 5 décembre 2009 5 déc. 2009 à 13:19
Il y a aussi une bonne fonction sur developez.com:
http://delphi.developpez.com/faq/?page=typenombre#nombreenlettres J'ai enlever le paramètre "France: boolean" ici:
function NombreEnLettres(n : integer) : string;
Const
unite : array[1..19] of string = ('un','deux','trois','quatre','cinq','six',
'sept','huit','neuf','dix','onze','douze',
'treize','quatorze','quinze','seize',
'dix sept','dix huit','dix neuf');
dizaineF: array[2.. 9] of string = ('vingt','trente','quarante','cinquante',
'soixante','','quatre-vingt','');
dizaineB: array[2.. 9] of string = ('vingt','trente','quarante','cinquante',
'soixante','septante','octante','nonante');
coefs : array[0.. 3] of string = ('cent','mille','million','milliard');
Var
temp : String;
c, d, u : Integer;
coef : Integer;
i : Integer;
neg : boolean;
Begin
result := '';
// Cas particulier de zéro
If n = 0 then
begin
result := ' zero';
exit;
end;
// Mémorisation du signe
neg := n < 0;
If neg then n := -n;
coef:=0;
Repeat
// Récupération de l'unité du bloc de trois chiffres en cours
u:=n mod 10; n:=n div 10;
// Récupération de la dizaine du bloc de trois chiffres en cours
d:=n mod 10; n:=n div 10;
// Traitement des dizaines
temp := '';
// Passage sur la dizaine inférieure pour 10 à 19
// et pour 70-79 90-99 dans le cas de la France
If (d=1) Or ((d in [7,9])) then
begin
Dec(d);
Inc(u,10);
end;
if d > 1 then
begin
temp := ' ' + DizaineF[d];
// Ajout du cas particulier de 'et' entre la dizaine et 1 if (d < 8) and ((u 1) or (u 11)) then
temp := temp + ' et';
end;
// ajout du texte de l'unité
if u > 0 then temp := temp + ' ' + unite[u];
// ajout du 's' à Quatre-vingt si rien ne suit If (result '') and (d 8) and (u = 0) then result := 's';
result := temp + result;
// Récupération de la centaine du bloc de trois chiffres en cours
c := n mod 10; n := n div 10; {Récupère centaine}
If c > 0 then
begin
temp := '';
if c > 1 then temp := ' ' + unite[c] + temp;
temp := temp + ' ' + coefs[0];
// Traitement du cas particulier du 's' à cent si rien ne suit
If (result = '') and (c > 1) then result := 's';
result := temp + result;
end;
// Traitement du prochain groupe de 3 chiffres
if n > 0 then
begin
Inc(coef);
I := n mod 1000;
If (i > 1) and (coef > 1) then result := 's' + result;
If i > 0 then result := ' ' + coefs[coef] + result;
// Traitement du cas particulier 'mille' ( non pas 'un mille' ) If (i 1) and (coef 1) then Dec(n);
end;
until n = 0;
result := Trim(result);
// Ajout du signe en cas de besoin
if neg then result := 'moins ' + result;
End;
kachwahed
Messages postés18Date d'inscriptionsamedi 6 décembre 2008StatutMembreDernière intervention 5 décembre 2009 5 déc. 2009 à 13:16
16 janv. 2012 à 13:42
2 mars 2011 à 15:42
SVP aidez moi.
MERCI
5 déc. 2009 à 13:19
http://delphi.developpez.com/faq/?page=typenombre#nombreenlettres
J'ai enlever le paramètre "France: boolean" ici:
function NombreEnLettres(n : integer) : string;
Const
unite : array[1..19] of string = ('un','deux','trois','quatre','cinq','six',
'sept','huit','neuf','dix','onze','douze',
'treize','quatorze','quinze','seize',
'dix sept','dix huit','dix neuf');
dizaineF: array[2.. 9] of string = ('vingt','trente','quarante','cinquante',
'soixante','','quatre-vingt','');
dizaineB: array[2.. 9] of string = ('vingt','trente','quarante','cinquante',
'soixante','septante','octante','nonante');
coefs : array[0.. 3] of string = ('cent','mille','million','milliard');
Var
temp : String;
c, d, u : Integer;
coef : Integer;
i : Integer;
neg : boolean;
Begin
result := '';
// Cas particulier de zéro
If n = 0 then
begin
result := ' zero';
exit;
end;
// Mémorisation du signe
neg := n < 0;
If neg then n := -n;
coef:=0;
Repeat
// Récupération de l'unité du bloc de trois chiffres en cours
u:=n mod 10; n:=n div 10;
// Récupération de la dizaine du bloc de trois chiffres en cours
d:=n mod 10; n:=n div 10;
// Traitement des dizaines
temp := '';
// Passage sur la dizaine inférieure pour 10 à 19
// et pour 70-79 90-99 dans le cas de la France
If (d=1) Or ((d in [7,9])) then
begin
Dec(d);
Inc(u,10);
end;
if d > 1 then
begin
temp := ' ' + DizaineF[d];
// Ajout du cas particulier de 'et' entre la dizaine et 1 if (d < 8) and ((u 1) or (u 11)) then
temp := temp + ' et';
end;
// ajout du texte de l'unité
if u > 0 then temp := temp + ' ' + unite[u];
// ajout du 's' à Quatre-vingt si rien ne suit If (result '') and (d 8) and (u = 0) then result := 's';
result := temp + result;
// Récupération de la centaine du bloc de trois chiffres en cours
c := n mod 10; n := n div 10; {Récupère centaine}
If c > 0 then
begin
temp := '';
if c > 1 then temp := ' ' + unite[c] + temp;
temp := temp + ' ' + coefs[0];
// Traitement du cas particulier du 's' à cent si rien ne suit
If (result = '') and (c > 1) then result := 's';
result := temp + result;
end;
// Traitement du prochain groupe de 3 chiffres
if n > 0 then
begin
Inc(coef);
I := n mod 1000;
If (i > 1) and (coef > 1) then result := 's' + result;
If i > 0 then result := ' ' + coefs[coef] + result;
// Traitement du cas particulier 'mille' ( non pas 'un mille' ) If (i 1) and (coef 1) then Dec(n);
end;
until n = 0;
result := Trim(result);
// Ajout du signe en cas de besoin
if neg then result := 'moins ' + result;
End;
5 déc. 2009 à 13:16
http://www.fobec.com/protec/grenier2/encadre.php3?cat=VDivers&id_log=60
par: Jean Jamet
et:
http://www.phidels.com/php/index.php3?page=../php/pagetelechargementzip.php3&id=242&PHPSESSID=f2c953407e61f5c4eeae850c98d6f34b
par: Amar Guessas
9 janv. 2009 à 15:29
merci
22 juin 2008 à 12:49
13 janv. 2006 à 20:25
C'est code n'est pas mal