read 57 as fifty seven

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samvb
    New Member
    • Oct 2006
    • 228

    read 57 as fifty seven

    how can i read such numbers, say 57 as fifty seven and paste it to caption of a form or hold it on a string? the input can include a two decimal points as well.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You can use the following code to spellout the number from oracle database and use the output in VB .

    Code:
    SELECT TO_CHAR(TO_DATE(57,'J'),'JSP') FROM DUAL

    Comment

    • samvb
      New Member
      • Oct 2006
      • 228

      #3
      i actually have the numbers in variables, not from database. just send 57 to a functino and the function returns fifty-seven. i know it iz possible coz i saw it in softwares, i just cant figure it out.

      Comment

      • danp129
        Recognized Expert Contributor
        • Jul 2006
        • 323

        #4
        You will need to take the initiative to find example source code that best fits your needs by trying to use some of the examples found in your searches. You may want to combine code from one example to another if one works better for the whole numbers but the other displays the decimals in the fasion you want.

        That being said, Google for:
        vb "money to words" OR "currency to words" OR "number to words" -vb.net

        Note that some countries may handle billion/trillion/quadrillion/etc.. differently:
        Million, Billion, Trillion...

        You will need to test the function to ensure that it will handle a number as large as you need and test for any rounding errors. Then you will need to ensure that the user cannot enter a value larger than the function can handle. You may end up wanting to pass the function the whole number first and then the decimal value as "0.##" separately and then concatenate the results to be able to handle larger values. IE a double can handle 999,999,999,999 ,999 but if you have .5+ on the end of that it will be rounded up and I think switch to a negative because VB uses signed data types. The code I played with changed 999,999,999,999 ,999.50 to "One Dollar and Zero Cents"

        This example worked decently but you have to fix the line wraps and you'll want to get rid of the cent rounding:
        Convert currency numbers into text by Newsgroup Posting

        Comment

        Working...