le code suivent convertir un nombre entier en caracteres (la langue arab) le nombre no doivent pas depasser (999 999 999 999 )
Source / Exemple :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Edit1Change(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1Change(Sender: TObject);
var numbr,milliar,million,mille,cent,res:string;
cen,dicem,dicem1,vingh:string;
i,y,x,c,v,d:integer;
t:array [1..12]of integer;
begin
x:=edit1.GetTextLen;
numbr:=edit1.Text;
if x<12 then
for i:=x+1 to 12 do
numbr:='0'+numbr;
//label1.Caption:=numbr;
y:=1 ;
for i:= 1 to 4 do
begin
t[y]:=strtoint(copy(numbr,y,1));
c:=t[y];
t[y+1]:=strtoint(copy(numbr,y+1,1));
v:=t[y+1];
t[y+2]:=strtoint(copy(numbr,y+2,1));
d:=t[y+2];
case c of
1:cen:='ãÇÆÉ';
2:cen:='ãÇÆÊíä';
3:cen:='ËáÇË ãÇÆÉ';
4:cen:='ÇÑÈÚ ãÇÆÉ';
5:cen:='ÎãÓ ãÇÆÉ';
6:cen:='ÓÊÉ ãÇÆÉ';
7:cen:='ÓÈÚÉ ãÇÆÉ';
8:cen:='ËãäíÉ ãÇÆÉ';
9:cen:='ÊÓÚÉ ãÇÆÉ';
end;
if v=1 then
case d of
0:dicem1:='ÚÔÑÉ';
1:dicem1:='ÇÍÏì ÚÔÑ';
2:dicem1:='ÇËäì ÚÔÑ';
3:dicem1:='ËáÇËÉ ÚÔÑ';
4:dicem1:='ÇÑÈÚÉ ÚÔÑ';
5:dicem1:='ÎãÓÉ ÚÔÑ';
6:dicem1:='ÓÊÉ ÚÔÑ';
7:dicem1:='ÓÈÚÉ ÚÔÑ';
8:dicem1:='ËãäíÉ ÚÔÑ';
9:dicem1:='ÊÓÚÉ ÚÔÑ';
end;
if v>1 then
case v of
2:vingh:='ÚÔÑæä';
3:vingh:='臂辊';
4:vingh:='ÇÑÈÚæä';
5:vingh:='ÎãÓæä';
6:vingh:='ÓÊæä';
7:vingh:='ÓÈÚæä';
8:vingh:='ËãÇäæä';
9:vingh:='ÊÓÚæä';
end;
case d of
1:dicem:='æÇÍÏ';
2:dicem:='ÇËäÇäí';
3:dicem:='ËáÇËÉ';
4:dicem:='ÇÑÈÚÉ';
5:dicem:='ÎãÓÉ';
6:dicem:='ÓÊÉ';
7:dicem:='ÓÈÚÉ';
8:dicem:='ËãäíÉ';
9:dicem:='ÊÓÚÉ';
end;
if c =0 then
begin
if v=0 then
if d=0 then res:=''
else res:=dicem
else
begin
if v=1 then res:=dicem1;
if v>1 then res:=dicem+' æ '+vingh;
end;
end;
if c <> 0 then
begin
if v=0 then res:=cen+' æ '+dicem
else
begin
if v=1 then res:=cen+' æ '+dicem1;
if v>1 then res:=cen+' æ '+dicem+' æ '+vingh;
end;
end;
if y=1 then
if res <>'' then milliar:=res+' ãáíÇÑ æ ';
if y=4 then
if res <>'' then million:=res+' ãáíæä æ ';
if y=7 then
if res <>'' then mille:=res+' ÇáÝ æ ';
if y=10 then
if res <>'' then cent:=res;
y:=y+3;
end;
label1.Caption:=milliar+million+mille+cent;
//label1.Caption:='';
edit1.SetFocus;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
const s=['1','2','3','4','5','6','7','8','9','0',char(vk_back)];
begin
if edit1.Text='' then edit1.Text:='0';
if not (key in s) then
key:=char(vk_capital);
end;
end.
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.