FT_NTOW()
Translate numeric value to words
Syntax
FT_NTOW( <nNumber> ) -> cWords
Arguments
<nNumber> An integer to translate
Returns
A text string representing <nNumber>
Description
Translates numeric input to a text string.
FT_NTOW is intended to be used with integers only. Since I don't
know what your application will be, I can't assume the type of
fraction you want returned (ninety nine cents, 99/100, .99, etc).
If you want the fraction in words, just pass it as an integer.
Do not pass a negative number! Handle negative numbers any way
you need to in your code. (ie: CR, DB, Negative, Minus, etc.)
Also, numeric 0 is returned as a null string. You will need to
make a decision how to output it (zero dollars, no dollars, etc).
Examples
? FT_NTOW( 999 ) -> Nine Hundred Ninety Nine
? FT_NTOW( 1000 ) -> One Thousand
? FT_NTOW( 23 ) + " Dollars and " + FT_NTOW( 99 ) + " Cents"
-> Twenty Three Dollars and Ninety Nine Cents
? FT_NTOW( 23 ) + " Dollars and " + "99/100"
-> Twenty Three Dollars and 99/100
x := -23.99
cents := str( (x - int( x )) * 100, 2, 0 ) + "/100"
x := int( x )
string := iif( x < 0, "Credit of ", "Debit of " )
? string + FT_NTOW( abs(x) ) + " Dollars and " + "99/100"
-> Credit of Twenty Three Dollars and 99/100
Source: NTOW.PRG
Author: Gary Baren