FT_NTOW

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

2 responses to “FT_NTOW

  1. Pingback: FT Functions | Viva Clipper !

  2. Pingback: FT Conversion | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.