number-to-words
number-to-words copied to clipboard
how to force writing zero fraction
how to force write zero fraction, so if i have 144.00 USD i get the fallowing
$currencyTransformer->toWords(14400, 'USD'); one hundred forty-four dollar.
i want to get one hundred forty-four dollar and zero cent .
You can't at the moment. Feel free to add the missing functionality. Thanks!
I can be wrong, but it seems to me that this functionality already exists (see #79 PR). I studied the code and added documentation.
PS: Immediately I apologize if something in the description is written incorrectly. I know English very poorly, so I translate Google Translate. ¯_(ツ)_/¯
is not working, or maybe i have missed something
$CurrencyTransformerOptions = new CurrencyTransformerOptions(); $CurrencyTransformerOptions->setConvertFractionIfZero(true); $CurrencyTransformerOptions->setShowDecimalIfZero(true); $numberToWords = new NumberToWords(); $currencyTransformer = $numberToWords->getCurrencyTransformer('en'); $text = $currencyTransformer->toWords(26400, 'USD', $CurrencyTransformerOptions);
output
two hundred sixty-four dollars