On Jul 30, 2012, at 11:28 AM, dunb...@aol.com wrote: > function digitToWord theDigits > put "One,Two,Three,Four,Five,Six,Seven,Eight,Nine" into ones > put "Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,"¬ > & "Eighteen,Nineteen" into teens > put ",Twenty,Thirty,Forty,Fifty,Sixty,Seventy,Eighty,Ninety" into tens > set numberformat to "#.00" > get offset(".",theDigits) > if it 0 then > put " Dollars and" && char it + 1 to it + 2 of theDigits & "/100" into > temp > delete char it to it + 2 of theDigits > end if > > get number(chars of theDigits) > if char it - 1 of theDigits = 1 then put item char it of theDigits + 1 of > teens before temp > else > put item char it of theDigits of ones before temp > put item char it - 1 of theDigits of tens & space before temp > end if > > if it 3 then put item char it - 2 of theDigits of ones && "Hundred" & > space before temp > if it = 4 then put item char it - 3 of theDigits of ones && "Thousand" & > space before temp > if it = 5 then put item char it - 4 of theDigits of tens && "Thousand" & > space before temp > if it = 6 then > put item char 1 of theDigits of ones && "Hundred" && item char 2 of > theDigits of tens && item char 3 of theDigits of ones & " Thousand " before > temp > end if > > return temp > end digitToWord
I think I lifted a similar handler from Hugh Senior some years ago and have been using it for years to print out receipts for copayments. Has been working like a charm. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode