function YTLtoYazi(Value: Double; LiraSimge, KurusSimge: string): string; const Birler: array[1..10] of string = ('Bir', 'İki', 'Üç', 'Dört', 'Beş', 'Altı', 'Yedi', 'Sekiz', 'Dokuz', ''); Onlar: array[1..10] of string = ('On', 'Yirmi', 'Otuz', 'Kırk', 'Elli', 'Altmış', 'Yetmiş', 'Seksen', 'Doksan', ''); Diger: array[1..11] of string = ('Trilyon', '', '', 'Milyar', '', '', 'Milyon', '', '', 'Bin', ''); var Deger: string; Lira: string; Kurus: string; i: integer; Uclu: string; LiraYok: Boolean; procedure UcSayi; var s1, s2, s3: byte; begin s1 := StrtoInt(Copy(Uclu, 1, 1)); s2 := StrtoInt(Copy(Uclu, 2, 1)); s3 := StrtoInt(Copy(Uclu, 3, 1)); if ((i = 10) and (Uclu = '001')) then begin s1 := 10; s2 := 10; s3 := 10; end; if s1 = 0 then s1 := 10; if s2 = 0 then s2 := 10; if s3 = 0 then s3 := 10; if s1 <> 1 then Result := Result + Birler[S1]; if s1 <> 10 then Result := Result + 'Yüz'; Result := Result + Onlar[S2] + Birler[S3]; end; begin
if Value < 0 then begin Deger := 'Eksi '; Value := Value * -1; end; Lira := InttoStr(Trunc(Int(Value))); Kurus := InttoStr(Trunc(RoundTo(Frac(Value), -2) * 100)); if Lira = '0' then LiraYok := True else LiraYok := False; if (Lira = '0') and (Kurus = '0') then Result := 'Sıfır';
Lira := RightStr(StringofChar('0', 15) + Lira, 15); Kurus := RightStr('000' + Kurus, 3); i := -2; repeat inc(i, 3); Uclu := Copy(Lira, i, 3); UcSayi; if ((Uclu <> '000') and (i < 13)) then Result := Result + Diger[i]; until i >= 12; if not LiraYok then Result := Result + ' ' + LiraSimge; if Kurus <> '000' then begin Result := Result + ' '; Uclu := Kurus; UcSayi; Result := Result + ' ' + KurusSimge; end; Result := Deger + Result; end; {$R *.dfm}
ÖRNEK
2.990 YTL
İKİBİNDOKUZYÜZDOKSANYENİTÜRKLİRASI
GİBİ