Discussion on:

6
Comments

Join the conversation!

Follow via:
RSS
Email Alert
Well, debugging we are - the amount

3000000.50
is three million Swiss francs fifty rapps

Just my CHF 0.02 (that's two rapps wink
0 Votes
+ -
Thanks
RexWorld 18th May 2004
Thanks for the correction happy
0 Votes
+ -
Well I think this is more of what we should be seeing these days. Though this article did not state if the class handles (numbers 0),
I should look it up and see for my self. and i wonder why it only handles decimals when it's currency....

Pumba
create a web app that converts numbers into words from 0(zero) to 100,000,000(one hundred million) in php.
I needed to be able to convert a percentage used in an interest rate to words. Sometimes the percentage included a decimal. Here is how I accomplished the task:

// See if "point" is located in interest rate
$pos = strpos($int_rate, '.');
if ($pos === false) {
// No Point
$wint_rate = $nw->toWords($int_rate) . " Percent";
} else {
//Point exists
$arr_int_rate = explode('.', $int_rate);
//$arr_int_rate[0] piece1
//$arr_int_rate[1] piece2
$arr_int_rate[1] = rtrim($arr_int_rate[1],'0'); // Trim off trailing 0
$wint_rate1 = $nw->toWords($arr_int_rate[0]);
$wint_rate2 = $nw->toWords($arr_int_rate[1]);
$wint_rate = $wint_rate1 . " Point " . $wint_rate2 . " Percent";
}
0 Votes
+ -
Thanks!
svet007 29th Dec
Clear and to the point. Good job!
Keyboard Shortcuts:
Prev
Next
Toggle
Join the conversation
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.