Change

I assume you meant "Eighty-Nineteen" for "Ninety Nine". I found this, http://www.frenchtutorial.com/en/learn-french/counting/70-99, is it what you want?

It will take me a while to make the time to wrap my head around it.

Wow. French counting is crazy.

Eighty in French is quatre-vingts.

quatre-vingts In English is four-twentys

Eighty one is quatre-vingt-un

80 blaze it

🤣 My wife heard me chuckling and she wanted to know what was up. It wasn't until I explained the background of this thread that I caught the four-twentys reference! 🙄😂

Yes, that's what I mean... "Eighty-Nineteen" for "Ninety Nine".

Well, I absolutely needed it in french, so I fiddled this formula (if anyone wants to simplify it, welcome !). Problems of french spelling mistakes are normally ok,I think,because french is really hard with spelling numbers.

" ----------------------";
" - TABLE DES DIZAINES -";
" ----------------------";
let x := ["zéro ", "un ", "deux ", "trois ", "quatre ", "cinq ", "six ", "sept ", "huit ", "neuf ", "dix ", "onze ", "douze ", "treize ", "quatorze ", "quinze ", "seize ", "dix-sept ", "dix-huit ", "dix-neuf ", "vingt ", "vingt et un ", "vingt-deux ", "vingt-trois ", "vingt-quatre ", "vingt-cinq ", "vingt-six ", "vingt-sept ", "vingt-huit ", "vingt-neuf ", "trente ", "trente et un ", "trente-deux ", "trente-trois ", "trente-quatre ", "trente-cinq ", "trente-six ", "trente-sept ", "trente-huit ", "trente-neuf ", "quarante ", "quarante et un ", "quarante-deux ", "quarante-trois ", "quarante-quatre ", "quarante-cinq ", "quarante-six ", "quarante-sept ", "quarante-huit ", "quarante-neuf ", "cinquante ", "cinquante et un ", "cinquante-deux ", "cinquante-trois ", "cinquante-quatre ", "cinquante-cinq ", "cinquante-six ", "cinquante-sept ", "cinquante-huit ", "cinquante-neuf ", "soixante ", "soixante et un ", "soixante-deux ", "soixante-trois ", "soixante-quatre ", "soixante-cinq ", "soixante-six ", "soixante-sept ", "soixante-huit ", "soixante-neuf ", "soixante-dix ", "soixante et onze ", "soixante-douze ", "soixante-treize ", "soixante-quatorze ", "soixante-quinze ", "soixante-seize ", "soixante-dix-sept ", "soixante-dix-huit ", "soixante-dix-neuf ", "quatre-vingt ", "quatre-vingt-un ", "quatre-vingt-deux ", "quatre-vingt-trois ", "quatre-vingt-quatre ", "quatre-vingt-cinq ", "quatre-vingt-six ", "quatre-vingt-sept ", "quatre-vingt-huit ", "quatre-vingt-neuf ", "quatre-vingt-dix ", "quatre-vingt-onze ", "quatre-vingt-douze ", "quatre-vingt-treize ", "quatre-vingt-quatorze ", "quatre-vingt-quinze ", "quatre-vingt-seize ", "quatre-vingt-dix-sept ", "quatre-vingt-dix-huit ", "quatre-vingt-dix-neuf "];
void;
" --------------------------";
" - Centaine de milliards - ";
" --------------------------";
let nb_cent_mlrds := floor(En_chiffres / 100000000000);
let cent_mlrds := nb_cent_mlrds * 100000000000;
let l_cent_mlrds := if nb_cent_mlrds > 1 then
item(x, nb_cent_mlrds)
end + if nb_cent_mlrds > 0 then
if En_chiffres = cent_mlrds and nb_cent_mlrds > 1 then
"cents "
else
"cent "
end
end;
" -------------------------";
" - Dizaine de milliards - ";
" -------------------------";
let nb_diz_mlrds := floor((En_chiffres - cent_mlrds) / 1000000000);
let diz_mlrds := nb_diz_mlrds * 1000000000;
let l_diz_mlrds := if nb_diz_mlrds > 0 then
if item(x, nb_diz_mlrds) = "quatre-vingt " then
"quatre-vingts "
else
item(x, nb_diz_mlrds)
end
end + if nb_diz_mlrds > 0 or nb_cent_mlrds > 0 then
if cent_mlrds + diz_mlrds = En_chiffres and nb_cent_mlrds * 100 + nb_diz_mlrds > 1 then
"milliards d'"
else
if cent_mlrds + diz_mlrds = En_chiffres then
"milliard d'"
else
if nb_cent_mlrds * 100 + nb_diz_mlrds > 1 then
"milliards "
else
"milliard "
end
end
end
end;
" --------------------------";
" - centaines de millions - ";
" --------------------------";
let nb_cent_million := floor((En_chiffres - (cent_mlrds + diz_mlrds)) / 100000000);
let cent_million := nb_cent_million * 100000000;
let l_cent_million := if nb_cent_million > 1 then
item(x, nb_cent_million)
end + if nb_cent_million > 0 then
if En_chiffres = cent_mlrds + diz_mlrds + cent_million and nb_cent_million > 1 then
"cents "
else
"cent "
end
end;
" -------------------------";
" - dizaines de millions - ";
" -------------------------";
let nb_diz_million := floor((En_chiffres - (cent_mlrds + diz_mlrds + cent_million)) / 1000000);
let diz_million := nb_diz_million * 1000000;
let l_diz_million := if nb_diz_million > 0 then
if item(x, nb_diz_million) = "quatre-vingt " then
"quatre-vingts "
else
item(x, nb_diz_million)
end
end + if nb_diz_million > 0 or nb_cent_million > 0 then
if cent_mlrds + diz_mlrds + cent_million + diz_million = En_chiffres and nb_cent_million * 100 + nb_diz_million > 1 then
"millions d'"
else
if cent_mlrds + diz_mlrds + cent_million + diz_million = En_chiffres then
"million d'"
else
if nb_cent_million * 100 + nb_diz_million > 1 then
"millions "
else
"million "
end
end
end
end;
" -----------------------";
" - centaines de mille - ";
" -----------------------";
let nb_cent_mille := floor((En_chiffres - (cent_mlrds + diz_mlrds + cent_million + diz_million)) / 100000);
let cent_mille := nb_cent_mille * 100000;
let l_cent_mille := if nb_cent_mille > 1 then
item(x, nb_cent_mille)
end + if nb_cent_mille > 0 then "cent " end;
" ----------------------";
" - dizaines de mille - ";
" ----------------------";
let nb_diz_mille := floor((En_chiffres - (cent_mlrds + diz_mlrds + cent_million + diz_million + cent_mille)) / 1000);
let diz_mille := nb_diz_mille * 1000;
let l_diz_mille := if nb_diz_mille > 1 then
item(x, nb_diz_mille)
end + if nb_diz_mille > 0 or nb_cent_mille > 0 then
"mille "
end;
" --------------";
" - centaines - ";
" --------------";
let nb_cent := floor((En_chiffres - (cent_mlrds + diz_mlrds + cent_million + diz_million + cent_mille + diz_mille)) / 100);
let centaine := nb_cent * 100;
let l_centaine := if nb_cent > 1 then item(x, nb_cent) end + if nb_cent > 0 then
if En_chiffres = cent_mlrds + diz_mlrds + cent_million + diz_million + cent_mille + diz_mille + centaine and centaine > 1 then
"cents "
else
"cent "
end
end;
" -------------";
" - dizaines - ";
" -------------";
let nb_diz := floor(En_chiffres - (cent_mlrds + diz_mlrds + cent_million + diz_million + cent_mille + diz_mille + centaine));
let dizaine := nb_diz;
let l_dizaine := if nb_diz > 0 then
if item(x, nb_diz) = "quatre-vingt " then
"quatre-vingts "
else
item(x, nb_diz)
end
end;
" --------------";
" - décimales - ";
" --------------";
let decim := round(100 * (En_chiffres - floor(En_chiffres)), 0);
let l_decimale := if floor(En_chiffres) > 1 then
"euros"
else
"euro"
end + if decim > 0 then
" et " + item(x, decim) + if decim > 1 then "cents" else "cent" end
end;
l_cent_mlrds + l_diz_mlrds + l_cent_million + l_diz_million + l_cent_mille + l_diz_mille + l_centaine + l_dizaine + l_decimale

Olivier, well done. The only thing I would do differently is use the user-defined function and you can deleted the "void;". Glad you got it working. :)

Hi Sean, I'm sorry but I'm afraid I don't understand what you mean with the user-defined function. I don't understant why "void" automatically appears.

Hi Olivier, In my code there is a user-defined function named `numberToWord`. By using a function, you can reduce repeated code, but the important thing here is you've got it working. I was able to delete "void" and it didn't reappear so my *guess* is there is a variable declared in your code that isn't used so "void" is inserted.

OK, thank you Sean.

I create a user-defined function, it's really easier too use in the DB.