ConvertIntToWords ( )

Function stats

Average user rating
34
128
9999
Support
FileMaker 7.0 +
Date posted
09 December 2008
Last updated
09 December 2008
Version
Recursive function
No

Author Info
 The Shadow

22 functions

Average Rating 4.3

author_avatar



 

Function overview

Prototype

ConvertIntToWords  ( amount;   base )


Parameters

amount  The amount being converted


base  The current base (position)


Description

Converts an integer into words, part of a check-writing system. See ConvertMoneyToWords().

Examples

Sample input

ConvertIntToWords( 78654; 10^15 )


Sample output

seventy-eight thousand six hundred fifty-four

 

Function code

If (base=1; If (amount > 0; ConvertSmallIntToWords ( amount ));
Let ( [large = Div(amount;base); small = Mod(amount;base); nextBase = NextLowerBase( base ) ];
If ( large = 0; ConvertIntToWords( amount; nextBase );
Let ( rest = ConvertIntToWords( small; nextBase );
ConvertIntToWords(large;100) & " " & BaseName(base) & If (rest <> ""; " " & rest ) )
)
)
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/128

    Prototype: ConvertIntToWords( amount; base )
    Function Author: The Shadow (http://www.fmfunctions.com/mid/34)
    Last updated: 09 December 2008
    Version: 1.1

*/
// ===================================