{
Uzun zaman once musteri takip programi icin yazdigim kod.
Guvenle kullanabilirsiniz. Katirilyona kadar olan sayilari
destekler.
}
const
BIRLER: array[0..9] of string=('', 'Bir', 'Iki', 'Üc', 'Dört', 'Bes', 'Alti',
'Yedi', 'Sekiz', 'Dokuz');
ONLAR : array[0..9] of string=('', 'On', 'Yirmi', 'Otuz', 'Kirk', 'Elli', 'Altmis',
'Yetmis', 'Seksen', 'Doksan');
DIGER : array[0..5] of string=('', 'Bin', 'Milyon', 'Milyar', 'Trilyon', 'Katrilyon');
function SmallNum(N: Integer): string;
var
S: string[3];
begin
Result := '';
S := IntToStr(N);
if (Length(S)=1) then
S := '00' + S
else if (Length(S)=2) then
S := '0' + S;
if S[1]<>'0' then
if S[1]<>'1' then
Result := BIRLER[StrToInt(S[1])] + 'Yüz'
else
Result := 'Yüz';
Result := Result + ONLAR[StrToInt(S[2])];
Result := Result + BIRLER[StrToInt(S[3])];
end;
function NumStr(Num: Currency): string;
var
i, j, n, Nm: Integer;
S, Sn: string;
begin
S := FormatFloat('0', Num);
Sn := '';
if Num = 0 then
Sn := 'Sifir'
else if Length(S) < 4 then
Sn := SmallNum(Round(Num))
else
begin
I := 1;
J := Length(S) mod 3;
if J=0 then
begin
J := 3;
N := Length(S) div 3 - 1;
end
else
N := Length(S) div 3;
while i begin
Nm := StrToInt(Copy(S, I, J));
if (Nm=1) and (N=1) then
begin
Nm := 0;
Sn := Sn + SmallNum(Nm) + Diger[N];
end;
if Nm<>0 then
Sn := Sn + SmallNum(Nm) + Diger[N];
I := I + J;
J := 3;
N := N - 1;
end;
end;
Result := Sn;
end;
// Kullanimi:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := NumStr(StrToCurr(Edit1.Text));
end;