ToWords function for different languages

edited 11:17PM 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 11:17PM
    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 11:17PM
    Hello,

    ToWords(100.245, "dinar", "dinars") + (Round(100.245 * 1000) % 1000).ToString() + " fils"
  • edited 11:17PM
    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 11:17PM
    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 11:17PM
    ToWords(100.245, "dinar", "dinars") + "AND " + ToWords(Round(100.245 * 1000) % 1000, "fil", "fils")
  • edited 11:17PM
    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 11:17PM
    You need to replace % with Mod:

    ToWords(100.245, "dinar", "dinars") + "AND " + ToWords(Round(100.245 * 1000) Mod 1000, "fil", "fils")
  • edited 11:17PM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.