ToWords function for different languages

edited 3:16PM in FastReport .NET
Hi,

I went through previous threads for searching on ToWords function for different currencies,

what about for given us an overload function that has extra 2 parameters to take the integer side prefix like "Dollar" and fraction side prefix like "cents".

Comments

  • edited 3:16PM
    Hello,

    You can use the following expression:
    ToWords(100.24, "dollar", "dollars") + (Round(100.24 * 100) % 100).ToString() + " cents"
    will give you "One hundred dollars 24 cents".
  • edited June 2010
    hello alex

    i checked this function absolutely the best but i want to know that how can i do it for Kuwaiti Dinars

    Problem 1st :- in kuwait there are 3Decimals not 2
    Problem 2nd:- How can i use "Kuwaiti Dinars" instead of "US DOLLARS" and "FILS" Instead of "Cents"


    i hope u have solution for sure

    wait to hear from u soon


    with regards
  • edited 3:16PM
    Hello,

    ToWords(100.245, "dinar", "dinars") + (Round(100.245 * 1000) % 1000).ToString() + " fils"
  • edited 3:16PM
    AlexTZ wrote: »
    Hello,

    ToWords(100.245, "dinar", "dinars") + (Round(100.245 * 1000) % 1000).ToString() + " fils"


    but where should i keep this text to get result ??

    when i am keeping it to text i am getting error or the same thing
  • edited 3:16PM
    ok its working but returning

    One hundred dinars 245 fils

    i need like this

    One hundred dinars AND Two Hundred Forty Five fils

    hows that ?
  • edited 3:16PM
    ToWords(100.245, "dinar", "dinars") + "AND " + ToWords(Round(100.245 * 1000) % 1000, "fil", "fils")
  • edited 3:16PM
    ok thanks alex working fine

    just last and final question

    when report script is c# this line is working

    but i use vb as script so what whould i keep instead of this ??
  • edited 3:16PM
    You need to replace % with Mod:

    ToWords(100.245, "dinar", "dinars") + "AND " + ToWords(Round(100.245 * 1000) Mod 1000, "fil", "fils")
  • edited 3:16PM
    Hi,

    you can do in any currency with following function.
    i give you example with INDIAN currency.

    [Replace(Replace(ToWords(125.60),"dollars","rupees"),"cent","paise")]


    Output:

    One hundred and twenty-five rupees and 60 paise

Leave a Comment