## FREE FNKSHN LIBRARY

### FREE FNKSHN LIBRARY

this is a recent addition to the soon to be ready FNKSHN 1.1.  you can
download 1.01 at the site below.  i haven't messed much with recursion in
fox so i don't know what it's threshold is.

* NUMWORD(<expn>)
* takes a numeric digit up to 999 billion and turns it into words.
* warning: this call is recursive
*
procedure numword
parameter lnnum
private lnnum, lcnum, lcones, lctens, lc*s, lchuns, lcnumword
if type("LNNUM")#"N"
return ""
endif
lcones="one,two,three,four,five,six,seven,eight,nine,ten,"+;
"eleven,twelve,thir*,four*,fif*,six*,seven*,"+;
"eigh*,nine*"
lctens="ten,twenty,thirty,fourty,fifty,sixty,seventy,eighty,ninety"
lchuns="hundred,thousand,million,billion"
lcnumword=""
do case
case lnnum > 1000000000
lcnumword=lcnumword+numword(int(lnnum/1000000000))+" billion "+numword(lnnum-(int(lnnum/1000000000)*1000000000))
case lnnum > 1000000
lcnumword=lcnumword+numword(int(lnnum/1000000))+" million "+numword(lnnum-(int(lnnum/1000000)*1000000))
case lnnum > 1000
lcnumword=lcnumword+numword(int(lnnum/1000))+" thousand "+numword(lnnum-(int(lnnum/1000)*1000))
case lnnum > 100
lcnumword=lcnumword+getinfo(lcones,int(lnnum/100))+" hundred "+numword(lnnum-(int(lnnum/100)*100))
case lnnum > 19
lcnumword=lcnumword+getinfo(lctens,int(lnnum/10))+" "+numword(lnnum-(int(lnnum/10)*10))
otherwise
lcnumword=lcnumword+" "+getinfo(lcones,lnnum)
endcase
return alltrim(lcnumword)

--
d88b  d88b  8888b  88888 ,88. | perry fect, author of FNKSHN for foxpro!
88    88  88 88  88 88,,  MMMM | for details visit:
88    88  88 8888P  88""   ""  | http://www.veryComputer.com/~perfecto/fnkshn.html
Y88Y  Y88Y  88  88 88888  MM  | CORE! MCMXCVI

### FREE FNKSHN LIBRARY

>this is a recent addition to the soon to be ready FNKSHN 1.1.  you can
>download 1.01 at the site below.  i haven't messed much with recursion in
>fox so i don't know what it's threshold is.
>* NUMWORD(<expn>)
>* takes a numeric digit up to 999 billion and turns it into words.
>* warning: this call is recursive
>*
>procedure numword

[code snipped]

Why bother with recursive code?  It isn't needed.  All you need
to do is have the 0 to 999 part dealt with.  This should be broken out
into a separate function.

Sincerely,

Gene Wirchenko

C Pronunciation Guide:
y=x++;     "wye equals ex plus plus semicolon"
x=x++;     "ex equals ex doublecross semicolon"