Source Code



Money to Text

  • anonymous
  • Dec 21' 13
  • Delphi
  • 207
  • 172
  • United States

this is source code

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls;

type
  TForm1 = class(TForm)
    Label2: TLabel;
    Edit1: TEdit;
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
Function TERBILANG( n : int64) : String;
Const
Bil : Array[0..11] Of String[15] =
('''',''Satu'',''Dua'',''Tiga'',''Empat'',''Lima'',
''Enam'',''Tujuh'',''Delapan'',''Sembilan'',''Sepuluh'',''Sebelas'');
Begin
Case n Of
0..11 : Result := Bil[n];
12..19 : Result := Terbilang(n-10) + '' Belas'';
20..99 : Result := Terbilang(n div 10) + '' Puluh '' + Terbilang(n mod 10);
100..199 : Result := ''Seratus '' + Terbilang(n-100);
200..999 : Result := Terbilang(n div 100) + '' Ratus '' + Terbilang(n mod 100);
1000..1999: Result := ''Seribu '' + Terbilang(n-1000);
2000..9999: Result := Terbilang(n div 1000) + '' Ribu '' + Terbilang(n mod 1000);
10000..19999: Result := Terbilang(n div 1000) + '' Ribu '' + Terbilang(n mod 1000);
20000..99999: Result := Terbilang(n div 1000) + '' Ribu '' + Terbilang(n mod 1000);
100000..199999: Result := Terbilang(n div 1000) + '' Ribu '' + Terbilang(n mod 1000);
200000..999999: Result := Terbilang(n div 1000) + '' Ribu '' + Terbilang(n mod 1000);
1000000..1999999: Result := Terbilang(n div 1000000) + '' Juta '' + Terbilang(n mod 1000000);
2000000..9999999: Result := Terbilang(n div 1000000) + '' Juta '' + Terbilang(n mod 1000000);
10000000..19999999: Result := Terbilang(n div 1000000) + '' Juta '' + Terbilang(n mod 1000000);
20000000..99999999: Result := Terbilang(n div 1000000) + '' Juta '' + Terbilang(n mod 1000000);
100000000..199999999: Result := Terbilang(n div 1000000) + '' Juta ''+ Terbilang(n mod 1000000);
200000000..999999999: Result := Terbilang(n div 1000000) + '' Juta ''+ Terbilang(n mod 1000000);
1000000000..1999999999: Result := Terbilang(n div 1000000000) + '' Milyar ''+ Terbilang(n mod 1000000000);
//2000000000..9999999999: Result := Terbilang(n div 1000000000) + '' Milyar ''+ Terbilang(n mod 1000000000);

End;
End;

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
Var Digit1 : Char;
begin
If Edit1.text<>'''' Then
Begin
If Edit1.text=''0'' Then Panel1.Caption:=''Nol''
Else Panel1.Caption:= TERBILANG(STRtoINT(Edit1.text));
End
Else
Panel1.Caption:=''Kosong'';
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;

end.
  • Tags : money, text, spell
comments powered by Disqus



Category

Tag Linked