ConvertSmallIntToWords ( )

Function stats

Average user rating
34
127
9999
Support
FileMaker 7.0 +
Date posted
09 December 2008
Version
1
Recursive function
Yes

Author Info
 The Shadow

22 functions

Average Rating 4.3

author_avatar



 

Function overview

Prototype

ConvertSmallIntToWords  ( num )


Parameters

num  The number to convert


Description

Convert a small integer (<99) to english words. Part of a check-writing system, see ConvertMoneyToWords().

Examples

Sample input

87


Sample output

eighty-seven

 

Function code

Case( num < 10;
Case( num=9; "nine"; num=8; "eight"; num=7; "seven"; num=6; "six"; num=5; "five"; num=4; "four"; num=3; "three"; num=2; "two"; num=1; "one"; num=0; "zero" );
num < 20;
Case( num=10; "ten"; num=11; "eleven"; num=12; "twelve"; num=13; "thirteen"; num=14; "fourteen"; num=15; "fifteen"; num=16; "sixteen";
num=17; "seventeen"; num=18; "eighteen"; num=19; "nineteen" );
num < 30; If( num = 20; "twenty"; "twenty-" & ConvertSmallIntToWords( num-20 ) );
num < 40; If( num = 30; "thirty"; "thirty-" & ConvertSmallIntToWords( num-30 ) );
num < 50; If( num = 40; "fourty"; "fourty-" & ConvertSmallIntToWords( num-40 ) );
num < 60; If( num = 50; "fifty"; "fifty-" & ConvertSmallIntToWords( num-50 ) );
num < 70; If( num = 60; "sixty"; "sixty-" & ConvertSmallIntToWords( num-60 ) );
num < 80; If( num = 70; "seventy"; "seventy-" & ConvertSmallIntToWords( num-70 ) );
num < 90; If( num = 80; "eighty"; "eighty-" & ConvertSmallIntToWords( num-80 ) );
num < 100; If( num = 90; "ninety"; "ninety-" & ConvertSmallIntToWords( num-90 ) );
"<error - too large number in ConvertSmallIntToWords: " & num & ">"
)

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

    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/127

    Prototype: ConvertSmallIntToWords( num )
    Function Author: The Shadow (http://www.fmfunctions.com/mid/34)
    Last updated: 09 December 2008
    Version: 1

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