Hello Yongky,
modifikasi aja. kalo ketemu "decimalseparator" (. atau ,) akan memanggil
fungsi terbilang lagi...
atau coba ke www.scalabium.com, download aja komponen suite SMComponents
(gratis, with source). itu bisa dipake utk berbagai bahasa. sayangnya
limit angka yg digunakan lebih terbatas drpd yg kemaren saya kirim dan
selalu memakai currency.
saya gak tau itu udah yg terbaru atau belum, soalnya saya pernah kirim revisi
ke mike shkolnik, gak ada tanggapan. sebaiknya ganti aja file "moneystr.pas"
dgn yg ini:
**********************
{ Copyright (C) 1998-2003, written by Shkolnik Mike, Scalabium Software
E-Mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
WEB: http://www.scalabium.com
This component allow translate a number into verbal string.
For using you need:
- drop it on form
- define a desirable number in Value property, which you want translate into
verbal string
Also you can define in properties:
- Currency: currency for translation
1. ukrainian UAH
2. ukrainian karbobanets
3. US dollars
4. russian rubles
5. deutsche marks
6. british pounds
7. euro
8. Rands (South Africa)
9. Belgian Franc
10. Dominican Republic peso
11. Rupiah
12. Ringgit
- Language: language for translation
1. ukrainian
2. russian
3. english
4. german
5. spain
6. Indonesia
- Expand:
exWholeSum: True - expand in verbal string a whole part of number
('fourty five/45')
exWholeCurrency: True - expand in verbal string a currency for whole
part of number ('rubles/rub')
exFractionSum: True - expand in verbal string a fractioanl part of
number ('ten/10')
exFractionCurrency: True - expand a currency for fractional part of
number ('centes/cnt')
- CharCase:
ccLower: all characters in result string is lower
ccProper: first character is upper, all rest is lower
ccUpper: all characters in result string is upper
Also you can use it without component creation thought
run-time call a function, which will result a verbal string:
function GetMoneyStr(Value: Double; Expand: TExpand; Language: TLanguage;
Currency: TCurrency; CharCase: TCharCase): string;
Big thanks to Lars Paprotny ([EMAIL PROTECTED], [EMAIL PROTECTED]).
Without Lars help I couldn't create a english and german language support.
If anybody want to help me in new languages support then send
a message to me. But component is freeware and I cann't offer a fee.
}
unit MoneyStr;
interface
uses
Classes, StdCtrls;
type
TExpand = set of (exWholeSum, exWholeCurrency, exFractionSum,
exFractionCurrency);
TCurrency = (tcUAH, tcKarbovanec, tcUSD, tcRUR, tcDM, tcPound, tcEuro,
tcRand, tcBelgianFranc, tcPeso, tcRupiah, tcRinggit);
TLanguage = (tlUkrainian, tlRussian, tlEnglish, tlGerman, tlSpain,
tlIndonesia);
TCharCase = (ccLower, ccProper, ccUpper);
const Thousands: array[TLanguage] of array[1..4, 1..3] of string[15] =
((('������', '�����i', '�����'),
('�i�����', '�i������', '�i�����i�'),
('�i�i���', '�i�i����', '�i�i���i�'),
('����i��', '����i���', '����i��i�')),
(('������', '������', '�����'),
('�������', '��������', '���������'),
('��������', '���������', '����������'),
('��������', '���������', '����������')),
(('thousand', 'thousand', 'thousands'),
('million', 'million', 'millions'),
('billion', 'billion', 'billions'),
('trillion', 'trillion', 'trillions')),
(('Tausend', 'Tausend', 'Tausend'),
('Million', 'Million', 'Millionen'),
('Milliarde', 'Milliarde', 'Milliarden'),
('Billion', 'Billion', 'Billionen')),
(('mil', 'mil', 'mil'),
('mill�n', 'mill�n', 'mill�n'),
('bill�n', 'bill�n', 'bill�n'),
('trillyn', 'trillyn', 'trillyn')),
(('ribu', 'ribu', 'ribu'),
('juta', 'juta', 'juta'),
('milyar', 'milyar', 'milyar'),
('trilyun', 'trilyun', 'trilyun')));
const ShortCurrency: array[TLanguage] of array[0..10, 1..2] of string[3] =
((('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('��', ''),
('���', '���'),
('Rp.', 'sen')),
(('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('���', '���'),
('��', ''),
('���', '���'),
('Rp.', 'sen')),
(('grn', 'cop'),
('krb', 'cop'),
('$', 'cen'),
('rub', 'cop'),
('dm', 'pfg'),
('pnd', 'p'),
('eur', 'cen'),
('R', 'c'),
('BF', ''),
('RD', 'cts'),
('Rp.', 'sen')),
(('grn', 'cop'),
('krb', 'cop'),
('$', 'cen'),
('rub', 'cop'),
('dm', 'pfg'),
('pnd', 'p'),
('eur', 'cen'),
('R', 'c'),
('BF', ''),
('RD', 'cts'),
('Rp.', 'sen')),
(('grn', 'cop'),
('krb', 'cop'),
('$', 'cen'),
('rub', 'cop'),
('dm', 'pfg'),
('pnd', 'p'),
('eur', 'cen'),
('R', 'c'),
('BF', ''),
('RD', 'cts'),
('Rp.', 'sen')),
(('grn', 'cop'),
('krb', 'cop'),
('$', 'sen'),
('rub', 'cop'),
('dm', 'pfg'),
('pnd', 'p'),
('eur', 'sen'),
('R', 'c'),
('BF', ''),
('RD', 'cts'),
('Rp.', 'sen')));
const FullCurrency: array[TLanguage] of array[0..11, 1..6] of string[15] =
((('������', '������', '������', '���i���', '���i���',
'���i���'),
('�����������', '����������', '�����������', '���i���', '���i���',
'���i���'),
('�����', '������', '�����i�', '����', '�����',
'����i�'),
('�����', '�����', '����i�', '���i���', '���i���',
'���i���'),
('�����', '�����', '�����', '����i�', '����i��',
'����i���'),
('����', '�����', '����i�', '����', '�����',
'����i�'),
('����', '����', '����', '����', '�����',
'����i�'),
('����', '�����', '������', '����', '�����',
'����i�'),
('�����', '������', '�������', '', '',
''),
('����', '����', '����', '�������', '�������',
'�������'),
('rupiah', 'rupiah', 'rupiah', 'sen', 'sen',
'sen'),
('ringgit', 'ringgit', 'ringgit', 'sen', 'sen',
'sen')),
(('������', '������', '������', '�������', '�������',
'������'),
('����������', '����������', '�����������', '�������', '�������',
'������'),
('������', '�������', '��������', '����', '�����',
'������'),
('�����', '�����', '������', '�������', '�������',
'������'),
('�����', '�����', '�����', '������', '�������',
'��������'),
('����', '�����', '������', '����', '�����',
'������'),
('����', '����', '����', '����', '�����',
'������'),
('����', '�����', '������', '����', '�����',
'����i�'),
('�����', '������', '�������', '', '', ''),
('����', '����', '����', '�������', '�������',
'�������'),
('rupiah', 'rupiah', 'rupiah', 'sen', 'sen',
'sen'),
('ringgit', 'ringgit', 'ringgit', 'sen', 'sen',
'sen')),
(('gruvnya', 'gruvnya', 'gruvnies', 'kopeck', 'kopeck',
'kopecks'),
('karbovanec', 'karbovanec', 'karbovanecs', 'kopeck', 'kopeck',
'kopecks'),
('dollar', 'dollar', 'dollars', 'cent', 'cent',
'cents'),
('ruble', 'ruble', 'rubles', 'kopeck', 'kopeck',
'kopecks'),
('deutsche mark', 'deutsche mark', 'deutsche marks', 'pfennig',
'pfennig', 'pfennigs'),
('pound', 'pound', 'pounds', 'penny', 'penny',
'pence'),
('euro', 'euro', 'euros', 'cent', 'cent',
'cents'),
('Rand', 'Rand', 'Rand', 'cent', 'cent',
'cents'),
('Belgian Franc', 'Belgian Franc', 'Belgian Francs', '',
'', ''),
('peso', 'peso', 'pesos', 'centavo', 'centavo',
'centavos'),
('rupiah', 'rupiah', 'rupiahs', 'sen', 'sen',
'sens'),
('ringgit', 'ringgit', 'ringgit', 'sen', 'sen',
'sen')),
(('gruvnya', 'gruvnya', 'gruvnies', 'kopeck', 'kopeck',
'kopecks'),
('karbovanec', 'karbovanec', 'karbovanecs', 'kopeck', 'kopeck',
'kopecks'),
('dollar', 'dollar', 'dollars', 'cent', 'cent',
'cents'),
('ruble', 'ruble', 'rubles', 'kopeck', 'kopeck',
'kopecks'),
('Deutsche Mark', 'Deutsche Mark', 'Deutsche Marks', 'Pfennig',
'Pfennig', 'Pfennige'),
('pound', 'pound', 'pounds', 'penny', 'penny',
'pence'),
('euro', 'euro', 'euros', 'cent', 'cent',
'cents'),
('Rand', 'Rand', 'Rand', 'cent', 'cent',
'cents'),
('Belgian Franc', 'Belgian Franc', 'Belgian Francs', '',
'', ''),
('peso', 'peso', 'pesos', 'centavo', 'centavo',
'centavos'),
('rupiah', 'rupiah', 'rupiah', 'sen', 'sen',
'sen'),
('ringgit', 'ringgit', 'ringgit', 'sen', 'sen',
'sen')),
(('gruvnya', 'gruvnya', 'gruvnies', 'kopeck', 'kopeck',
'kopecks'),
('karbovanec', 'karbovanec', 'karbovanecs', 'kopeck', 'kopeck',
'kopecks'),
('dollar', 'dollar', 'dollars', 'cent', 'cent',
'cents'),
('ruble', 'ruble', 'rubles', 'kopeck', 'kopeck',
'kopecks'),
('deutsche mark', 'deutsche mark', 'deutsche marks', 'pfennig',
'pfennig', 'pfennigs'),
('pound', 'pound', 'pounds', 'pence', 'pence',
'pences'),
('euro', 'euro', 'euros', 'cent', 'cent',
'cents'),
('Rand', 'Rand', 'Rand', 'cent', 'cent',
'cents'),
('Belgian Franc', 'Belgian Franc', 'Belgian Francs', '',
'', ''),
('peso', 'peso', 'pesos', 'centavo', 'centavo',
'centavos'),
('rupiah', 'rupiah', 'rupiah', 'sen', 'sen',
'sen'),
('ringgit', 'ringgit', 'ringgit', 'sen', 'sen',
'sen')),
(('gruvnya', 'gruvnya', 'gruvnya', 'kopek', 'kopek',
'kopek'),
('karbovanek', 'karbovanek', 'karbovanek', 'kopek', 'kopek',
'kopek'),
('dollar', 'dollar', 'dollar', 'sen', 'sen', 'sen'),
('rubel', 'rubel', 'rubel', 'kopek', 'kopek',
'kopek'),
('Mark Jerman', 'Mark Jerman', 'Mark Jerman', 'pfennig', 'pfennig',
'pfennig'),
('pound', 'pound', 'pound', 'penny', 'penny',
'pence'),
('euro', 'euro', 'euro', 'sen', 'sen', 'sens'),
('Rand', 'Rand', 'Rand', 'sen', 'sen', 'sen'),
('Franc Belgia', 'Franc Belgia', 'Franc Belgia', '',
'', ''),
('peso', 'peso', 'peso', 'centavo', 'centavo',
'centavo'),
('rupiah', 'rupiah', 'rupiah', 'sen', 'sen',
'sen'),
('ringgit', 'ringgit', 'ringgit', 'sen', 'sen',
'sen')));
const Literal: array[TLanguage] of array[0..19, 1..4] of string[15] =
((('', '', '', '����'),
('����', '����', '', '���'),
('��i', '���', '��������', '��i��i'),
('���', '���', '��������', '������'),
('������', '������', '�����', '���������'),
('�''���', '�''���', '�''�������', '�''�����'),
('�i���', '�i���', '�i�������', '�i������'),
('�i�', '�i�', '�i������', '�i����'),
('�i�i�', '�i�i�', '�i�i������', '�i�i����'),
('���''���', '���''���', '���������', '���''�����'),
('������', '������', '', ''),
('����������', '����������', '', ''),
('����������', '����������', '', ''),
('����������', '����������', '', ''),
('������������', '������������', '', ''),
('�''���������', '�''���������', '', ''),
('�i���������', '�i���������', '', ''),
('�i��������', '�i��������', '', ''),
('�i�i��������', '�i�i��������', '', ''),
('���''���������', '���''���������', '', '')),
(('', '', '', '����'),
('����', '����', '', '���'),
('���', '���', '��������', '������'),
('���', '���', '��������', '������'),
('������', '������', '�����', '���������'),
('����', '����', '���������', '�������'),
('�����', '�����', '����������', '��������'),
('����', '����', '���������', '�������'),
('������', '������', '�����������', '���������'),
('������', '������', '���������', '���������'),
('������', '������', '', ''),
('����������', '����������', '', ''),
('����������', '����������', '', ''),
('����������', '����������', '', ''),
('������������', '������������', '', ''),
('����������', '����������', '', ''),
('�����������', '�����������', '', ''),
('����������', '����������', '', ''),
('������������', '������������', '', ''),
('������������', '������������', '', '')),
(('', '', '', 'zero'),
('one', 'one', '', 'one hundred'),
('two', 'two', 'twenty', 'two hundred'),
('three', 'three', 'thirty', 'three hundred'),
('four', 'four', 'forty', 'four hundred'),
('five', 'five', 'fifty', 'five hundred'),
('six', 'six', 'sixty', 'six hundred'),
('seven', 'seven', 'seventy', 'seven hundred'),
('eight', 'eight', 'eighty', 'eight hundred'),
('nine', 'nine', 'ninety', 'nine hundred'),
('ten', 'ten', '', ''),
('eleven', 'eleven', '', ''),
('twelve', 'twelve', '', ''),
('thirteen', 'thirteen', '', ''),
('fourteen', 'fourteen', '', ''),
('fifteen', 'fifteen', '', ''),
('sixteen', 'sixteen', '', ''),
('seventeen', 'seventeen', '', ''),
('eighteen', 'eighteen', '', ''),
('nineteen', 'nineteen', '', '')),
(('', '', '', 'null'),
('eins', 'ein', '', 'einhundert'),
('zwei', 'zwei', 'zwanzig', 'zweihundert'),
('drei', 'drei', 'dreissig', 'dreihundert'),
('vier', 'vier', 'vierzig', 'vierhundert'),
('fuenf', 'fuenf', 'fuenfzig', 'fuenfhundert'),
('sechs', 'sechs', 'sechzig', 'sechshundert'),
('sieben', 'sieben', 'siebzig', 'siebenhundert'),
('acht', 'acht', 'achtzig', 'achthundert'),
('neun', 'neun', 'neunzig', 'neunhundert'),
('zehn', 'zehn', '', ''),
('elf', 'elf', '', ''),
('zwoelf', 'zwoelf', '', ''),
('dreizehn', 'dreizehn', '', ''),
('vierzehn', 'vierzehn', '', ''),
('fuenfzehn', 'fuenfzehn', '', ''),
('sechzehn', 'sechzehn', '', ''),
('siebzehn', 'siebzehn', '', ''),
('achtzehn', 'achtzehn', '', ''),
('neunzehn', 'neunzehn', '', '')),
(('', '', '', 'cero'),
('uno', 'una', '', 'cien'),
('dos', 'dos', 'veinte', 'dos cientos'),
('tres', 'tres', 'treinta', 'tres cientos'),
('cuatro', 'cuatro', 'cuarenta', 'cuatro cientos'),
('cinco', 'cinco', 'cincuenta', 'quinientos'),
('seis', 'seis', 'sesenta', 'seiscientos'),
('siete', 'siete', 'setenta', 'setecientos'),
('ocho', 'ocho', 'ochenta', 'ochocientos'),
('nueve', 'nueve', 'noventa', 'novecientos'),
('diez', 'diez', '', ''),
('once', 'once', '', ''),
('doce', 'doce', '', ''),
('trece', 'trece', '', ''),
('catorce', 'catorce', '', ''),
('quince', 'quince', '', ''),
('diecis�is', 'diecis�is', '', ''),
('diecisiete', 'diecisiete', '', ''),
('dieciocho', 'dieciocho', '', ''),
('diecinueve', 'diecinueve', '', '')),
(('', '', '', 'nol'),
('satu', 'satu', '', 'seratus'),
('dua', 'dua', 'dua puluh', 'dua ratus'),
('tiga', 'tiga', 'tiga puluh', 'tiga ratus'),
('empat', 'empat', 'empat puluh', 'empat ratus'),
('lima', 'lima', 'lima puluh', 'lima ratus'),
('enam', 'enam', 'enam puluh', 'enam ratus'),
('tujuh', 'tujuh', 'tujuh puluh', 'tujuh ratus'),
('delapan', 'delapan', 'delapan puluh', 'delapan ratus'),
('sembilan', 'sembilan', 'sembilan puluh', 'sembilan
ratus'),
('sepuluh', 'sepuluh', '', ''),
('sebelas', 'sebelas', '', ''),
('dua belas', 'dua belas', '', ''),
('tiga belas', 'tiga belas', '', ''),
('empat belas', 'empat belas', '', ''),
('lima belas', 'lima belas', '', ''),
('enam belas', 'enam belas', '', ''),
('tujuh belas', 'tujuh belas', '', ''),
('delapan belas', 'delapan belas', '', ''),
('sembilan belas', 'sembilan belas', '', '')));
type
TMoneyString = class(TCustomLabel)
private
{ Private declarations }
FCharCase: TCharCase;
FValue: Double;
FCurrency: TCurrency;
FLanguage: TLanguage;
FExpand: TExpand;
procedure BuildMoneyString;
protected
{ Protected declarations }
procedure SetCharCase(Val: TCharCase);
procedure SetValue(Val: Double);
procedure SetCurrency(Val: TCurrency);
procedure SetLanguage(Val: TLanguage);
procedure SetExpand(Val: TExpand);
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property Value: Double read FValue write SetValue;
property Currency: TCurrency read FCurrency write SetCurrency default tcUSD;
property Language: TLanguage read FLanguage write SetLanguage default
tlEnglish;
property Expand: TExpand read FExpand write SetExpand;
property CharCase: TCharCase read FCharCase write SetCharCase;
property Align;
property Alignment;
// property AutoSize;
property Color;
property DragCursor;
property DragMode;
property Enabled;
property FocusControl;
property Font;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Transparent;
property Layout;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
procedure Register;
function GetMoneyStr(Value: Double; Expand: TExpand; Language: TLanguage;
Currency: TCurrency; CharCase: TCharCase): string;
implementation
uses SysUtils, StrUtils;
procedure Register;
begin
RegisterComponents('SMComponents', [TMoneyString]);
end;
function GetDeclension(Digit: Char): Integer;
begin
Result := 3;
if (Digit = '1') then
Result := 1
else
if (Digit in ['2', '3', '4']) then
Result := 2
end;
function AddSpaces(s1, s2, s3, s4: ShortString): ShortString;
begin
Result := '';
if s1 <> '' then Result := Result + s1 + ' ';
if s2 <> '' then Result := Result + s2 + ' ';
if s3 <> '' then Result := Result + s3 + ' ';
if s4 <> '' then Result := Result + s4 + ' ';
end;
function GetMoneyString(IntPart: Boolean; strValue: ShortString; Expand:
TExpand; Language: TLanguage; Currency: TCurrency): string;
var
strRevert, PP, tmpStr : ShortString;
Res : string;
PK: array[1..3] of ShortString;
DL, k, PG: Integer;
N: Double;
begin
strRevert := '000000000000000';
DL := Length(strValue);
// calculate amount of triads in number
if (DL mod 3 = 0) then
N := DL/3
else
N := DL/3 + 1;
N := Int(N);
// create a reverse string with additional '0' in right (up to 15 characters)
k := 1;
while (k <= 255) do
begin
if (k <= DL) then
strRevert[k] := strValue[DL - k + 1]
else
strRevert[k] := '0';
Inc(k)
end;
Result := '';
if ((IntPart = True) and (exWholeSum in Expand)) or
((IntPart = False) and (exFractionSum in Expand)) then
begin
{ if number is zero }
if (StrToFloat(strValue) = 0) then
Result := Literal[Language][0, 4] + ' '
else
begin
k := 0;
while (k < N) do
begin
PP := '';
PK[1] := '';
PK[2] := '';
PK[3] := '';
if (strRevert[3 + 3*k] <> '0') then
PK[1] := Literal[Language][StrToInt(strRevert[3+3*k]), 4]
else
PK[1] := '';
if (strRevert[2 + 3*k] <> '0') then
begin
if (strRevert[2 + 3*k] = '1') then
begin
PK[2] := Literal[Language][StrToInt(strRevert[1+3*k])+10, 2];
PK[3] := '';
end
else
begin
PK[2] := Literal[Language][StrToInt(strRevert[2+3*k]), 3];
if ((k = 0) or (k = 1)) and (Currency in [tcUAH, tcDM, tcEuro]) then
PK[3] := Literal[Language][StrToInt(strRevert[1+3*k]), 1]
else
PK[3] := Literal[Language][StrToInt(strRevert[1+3*k]), 2]
end
end
else
begin
PK[2] := '';
if (strRevert[1+3*k] = '0') then
PK[3] := ''
else
if ((k = 0) or (k = 1)) and
(Currency in [tcUAH, tcDM, tcEuro]) then
PK[3] := Literal[Language][StrToInt(strRevert[1+3*k]), 1]
else
PK[3] := Literal[Language][StrToInt(strRevert[1+3*k]), 2];
end;
if (Language = tlGerman) and
(strRevert[2 + 3*k] > '1') then
begin
PK[2] := PK[3] + 'und' + PK[2];
PK[3] := ''
end;
if k > 0 then
begin
if (strRevert[1 + 3*k] <> '0') or
(strRevert[2 + 3*k] <> '0') or
(strRevert[3 + 3*k] <> '0') then
begin
{ if it isn't the first teens (11..19) }
if (strRevert[2 + 3*k] <> '1') then
PP := Thousands[Language][k, GetDeclension(strRevert[1 + 3*k])]
else
PP := Thousands[Language][k, 3];
end // if
end; // if
Result := AddSpaces(PK[1], PK[2], PK[3], PP) + Result;
Inc(k)
end // do
end //if
end
else
Result := strValue + ' ';
{ add a currency }
if strValue[DL - 1] = '1' then
PG := 3
else
PG := GetDeclension(strValue[DL]);
if (IntPart = True) then
begin
if (exWholeCurrency in Expand) then
Result := Result + FullCurrency[Language][Ord(Currency), PG]
else
Result := Result + ShortCurrency[Language][Ord(Currency), 1] + '.';
end
else
begin
if (exFractionCurrency in Expand) then
Result := Result + FullCurrency[Language][Ord(Currency), 3+PG]
else
Result := Result + ShortCurrency[Language][Ord(Currency), 2] + '.';
end;
// **** REVISION BEGIN ***** //
// Added Register procedure for component pallete, not installed by default (?)
// Added StrUtils unit at the uses clause to use the StringReplace function
// Added tmpStr & Res variables at the function's var
// Small revisions on the Indonesian language for cent -> sen
//
// This small routine corrects the 1000~1999 bug in Indonesian language.
// 1000: seribu, 1200: seribu dua ratus <CORRECT>
// previously: 1000: satu ribu, 1200: satu ribu dua ratus <WRONG>
//
if (Language = tlIndonesia) then
begin
tmpStr := RightStr(strValue, 6);
if ((tmpStr[1] = '0') and (tmpStr[2] = '0') and (tmpStr[3] = '1')) or
((StrToFloat(strValue) < 2000) and (StrToFloat(strValue) > 999)) then
begin
Res := StringReplace(Result,'satu ribu','seribu',[rfIgnoreCase]);
Result := Res;
end;
end;
// **** REVISION END ***** //
end;
function GetMoneyStr(Value: Double; Expand: TExpand; Language: TLanguage;
Currency: TCurrency; CharCase: TCharCase): string;
var
s: string;
begin
s := GetMoneyString(True, FloatToStr(Trunc(Value)), Expand, Language,
Currency) +
' ' +
GetMoneyString(False, FloatToStr(Round(Frac(Value)*100)), Expand,
Language, Currency);
case CharCase of
ccProper: s[1] := AnsiUpperCase(s[1])[1];
ccUpper: s := AnsiUpperCase(s);
end;
Result := s;
end;
{ TMoneyString }
constructor TMoneyString.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FCurrency := tcUSD;
FLanguage := tlEnglish;
WordWrap := True;
AutoSize := False;
FExpand := [exWholeSum, exWholeCurrency, exFractionSum, exFractionCurrency];
Value := 1;
end;
procedure TMoneyString.BuildMoneyString;
begin
Caption := GetMoneyStr(FValue, Expand, FLanguage, FCurrency, FCharCase);
end;
procedure TMoneyString.SetValue(Val: Double);
begin
if (FValue <> Val) then
begin
FValue := Val;
BuildMoneyString;
end;
end;
procedure TMoneyString.SetCurrency(Val: TCurrency);
begin
if (FCurrency <> Val) then
begin
FCurrency := Val;
BuildMoneyString;
end;
end;
procedure TMoneyString.SetLanguage(Val: TLanguage);
begin
if (FLanguage <> Val) then
begin
FLanguage := Val;
BuildMoneyString;
end;
end;
procedure TMoneyString.SetExpand(Val: TExpand);
begin
if (FExpand <> Val) then
begin
FExpand := Val;
BuildMoneyString;
end;
end;
procedure TMoneyString.SetCharCase(Val: TCharCase);
begin
if (FCharCase <> Val) then
begin
FCharCase := Val;
BuildMoneyString;
end;
end;
end.
*************************************************
Thursday, December 23, 2004, 8:30:21 AM, Yongky wrote:
Y> Saya sudah coba function terbilang yang anda kirim. Memang hasilnya
Y> sudah benar tapi tidak dapat mengkonversi terbilang sampai dengan
Y> bilangan decimal.
Y> Apakah anda ada function yang lain yang lebih lengkap ?
Y> Jika ada saya dapat di mana ? Atau anda punya sourcenya ?
Y> Thanks
--
Best regards,
Irwan
If you do that you have a chance of dying
Using The Bat! 2.10.03
----------
This E-mail is Certified Virus Free By TrendMicro (PT Chandra Asri)
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/i7folB/TM
--------------------------------------------------------------------~->
Berlangganan: [EMAIL PROTECTED]
Stop Berlangganan: [EMAIL PROTECTED]
Keluhan Milis(Unbouncing,spam,dll): [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Delphindo/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/