kali aja ada yg perlu. sekalian ngecek bugsnya. ;)
a.W.
/////////////
/// function : f_angka
// argument : num (value, decimal)
// return : string
//
// func. call : f_prop(str) -- buat Title Case
//
// author : Robot Gedek
decimal{2} a, b
double c, d
boolean suff, done
string abjad[9]
string str_milyar, str_juta, str_ribu, str_satuan, str
decimal{2} e1,e2,e3, tmp, tmp2, ix, jx
if num = 0 or isnull(num) then
return('')
end if
suff = true
str = ''
str_milyar = ''
str_juta = ''
str_ribu = ''
str_satuan = ''
abjad[1] = 'satu'
abjad[2] = 'dua'
abjad[3] = 'tiga'
abjad[4] = 'empat'
abjad[5] = 'lima'
abjad[6] = 'enam'
abjad[7] = 'tujuh'
abjad[8] = 'delapan'
abjad[9] = 'sembilan'
// ************************************* jutaan
*************************************
c = 100000000
d = 1000000
a = 100000
b = 1000000
ix = c * d
done = false
do while (not done)
// first
e1 = int(num / ix)
tmp = mod(num, ix)
num = num - (e1 * ix)
// second
e2 = int(tmp/ (ix/10) )
tmp2 = mod(tmp, (ix/10) )
num = num - (e2 * (ix/10))
// third
e3 = int(tmp2/ (ix/100) )
num = num - (e3 * (ix/100))
if e1=1 then
str = str + 'seratus '
else
if (e1 > 1 and e1 <= 9) then
str = str + abjad[e1] + ' ratus '
end if
end if
if (e2=1 and e3 = 0) then
str = str + 'sepuluh '
//suff = false
else
if (e2=1 and e3 = 1) then
str = str + 'sebelas '
//suff = false
else
if (e2=1 and e3 >= 2) then
str = str + abjad[e3] + ' belas '
else
if (e2>1 and e2<=9) then
str = str + abjad[e2] + ' puluh '
end if
end if
end if
end if
if (e3=1) and (ix=100000) and (e1=0) and (e2=0) then
// seribu
str = str + 'se'
else
if (e3>=1 and e3<=9 and e2<>1) then
str = str + abjad[e3] + ' '
end if
end if
if ( str<> '' ) and (e1>0 or e2>0 or e3>0) then
choose case (ix)
case (c * d)
str = str + 'trilyun '
case (a * b)
str = str + 'milyar '
case 100000000
str = str + 'juta '
case 100000
str = str + 'ribu '
case 100
//
end choose
end if
e1=0
e2=0
e3=0
ix = ix/1000
if num<1 then
done = true
end if
loop
//return f_prop(str)
//// bikin nyang koma-komaan...
integer num_koma
num_koma = num * 100
if num_koma > 0 then
if num_koma >= 10 then
if str = '' then
return f_prop('Nol koma ' +
f_prop(f_angka(num_koma)) )
else
return f_prop(str + 'koma ' +
f_prop(f_angka(num_koma)) )
end if
else
if str = '' then
return f_prop('Nol koma Nol ' +
f_prop(f_angka(num_koma)) )
else
return f_prop(str + 'koma Nol ' +
f_prop(f_angka(num_koma)) )
end if
end if
else
return f_prop(str)
end if
///////////////////
/// function : f_prop
// argument : str_it (value, string)
// return : string
//
// author : Robot Gedek
long i
string str_prop
boolean lower
// first big
lower=false
str_prop = upper(left(str_it,1))
for i = 2 to len(str_it)
// if under_wear -> buka!
if mid(str_it,i,1) = " " then
str_prop = str_prop + ' '
lower = true
else
if lower then
str_prop = str_prop + upper(mid(str_it,i,1))
else
str_prop = str_prop + lower(mid(str_it,i,1))
end if
lower=false
end if
end for
return (str_prop)
////////////////////////
_______________________________
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/NhFolB/TM
--------------------------------------------------------------------~->
IndoPB - Indonesia PB User Group
To Post a message, send it to: [EMAIL PROTECTED]
To Unsubscribe,send a blank message to: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indopb/
<*> 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/