1

Possible Duplicate:
converting numbers in to words C#

I am requiring an algorithm to convert currency amount to currency in words. The primary requirement is to have a generic algorithm so it takes culture information as a parameter along with the actual amount and display the amount in words accordingly and vice versa.

For example,

  • Input: 1157259.50 (Ringgits - Malaysian Currency)
  • Output: One Million One Hundred Fifty-Seven Thousand Two Hundred Fifty-Nine Ringgits and Fifty Cents
Community
  • 1
  • 1
Furqan Safdar
  • 16,260
  • 13
  • 59
  • 93
  • Currency symbol is availabe on CultureInfo, otherwise exact dup. – Alexei Levenkov Sep 24 '12 at 06:12
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Sep 24 '12 at 06:12
  • @FurqanSafdar Split the value into it's integer (Ringgits) and fractional (cents) portions, run each through the numbers to words algorithm them, append the currency names and add a conjunction ("and") in the middle. – akton Sep 24 '12 at 06:14
  • Thanks for the information but with due respect how to get the amount from the amount in words as i have mentioned in the body "vice versa"? – Furqan Safdar Sep 24 '12 at 06:19
  • 1
    What about countries where money amounts are not divide in base of 3 digits, Japan for example 35486 its read: "san (three) man, go (five) sen, yon (four) hiaku, hachi (eight) yu, roku (six) en (yen)"? – Ricardo Sotolongo Sep 24 '12 at 06:24
  • @rsotolongo same for Chinese. I guess this kind of algorithm might be culture-specific. – Guillaume Sep 24 '12 at 06:31
  • 1
    @Guillaume I think so, but the given example is focused in western culture that **maybe** _simplify_ the problematic. Also there are currencies that are divided in more than two units. Everything depends of what the questioner wants and meybe he should specify more data and examples. – Ricardo Sotolongo Sep 24 '12 at 06:39
  • 1
    If the OP requires something culture-specific I think it worths reopning the question. – Guillaume Sep 24 '12 at 06:52

0 Answers0