how can you convert a number to its corresponding wordings using formula language,for example:
18 = eighteen
117 - one hundred seventeen
1116 = one thousand one hundred sixteen
etc.
Help Please. Thank you in advance
how can you convert a number to its corresponding wordings using formula language,for example:
18 = eighteen
117 - one hundred seventeen
1116 = one thousand one hundred sixteen
etc.
Help Please. Thank you in advance
Subject: Try:
Try this as an example >>
Dollars := Amount;
AbsD := @Abs(Dollars);
Num := @Integer(AbsD);
Cents := @Round((AbsD - Num) * 100);
numnames := “One” : “Two” : “Three” : “Four” : “Five” : “Six” : “Seven” : “Eight” : “Nine” : “Ten” : “Eleven” : “Twelve” : “Thirteen” : “Fourteen” : “Fifteen” : “Sixteen” : “Seventeen” : “Eighteen” : “Ninteen”;
tensnames := “Ten” : “Twenty” : “Thirty” : “Forty” : “Fifty” : “Sixty” : “Seventy” : “Eighty” : “Ninety” : “One Hundred”;
sign := @If( Dollars < 0; @True; @False);
Base := 10;
D := @Modulo(Num / @Power(Base; 5 : 4 : 3 : 2 : 1 : 0); Base);
HTh := @Subset(@Subset(D; 1); -1);
TTh := @Subset(@Subset(D; 2); -1);
Th := @Subset(@Subset(D; 3); -1);
Hun := @Subset(@Subset(D; 4); -1);
Ten := @Subset(@Subset(D; 5); -1);
One := @Subset(@Subset(D; 6); -1);
SHTh := @If(HTh = 0; “”; @Subset(@Subset(NumNames; HTh); -1) : “Hundred”);
STTh := @If(TTh < 2; “”; @Subset(@Subset(tensnames; TTh); -1) + @If(Th = 0; “”; “-” + @Subset(@Subset(numnames; Th); -1)));
STh := @If(Num < 1000; “”; @If((TTh = 0 & Th = 0) | (TTh > 1); “”; @Subset(@Subset(numnames; @If(TTh = 1; 10; 0) + Th); -1)) : “Thousand”);
SHun := @If(Hun = 0; “”; @Subset(@Subset(numnames; Hun); -1) : “Hundred”);
STen := @If(Ten < 2; “”; @Subset(@Subset(tensnames; Ten); -1) + @If(One = 0; “”; “-” + @Subset(@Subset(numnames; One); -1)));
SOne := @If((Ten = 0 & One = 0) | (Ten > 1); “”; @Subset(@Subset(numnames; @If(Ten = 1; 10; 0) + One); -1));
Dol := @If(sign; “Minus”; “”) : SHTh : STTh : STh : SHun : STen : SOne : @If(Num = 0; “Zero”; “”);
Cen := "and " + @Right(“0” + @Text(Cents); 2) + “/100 Dollars”;
REM;
@Implode(@Trim(Dol : Cen); " ")
Subject: RE: Try:
thanks