how do i add currency value which i retrieve from the database to a number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omesh moreku

    how do i add currency value which i retrieve from the database to a number

    R 20.22 + StrToInt(Edit1->Text);
    how do i deal with this R
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You might consider using ftoa to convert the real to a string.

    Then you should be able to parse the string converting 20.22 as a string to 2022 as an int. That is, keep things in pennies.

    The only time you would need a decimal is when you report on the value. You could write a display function that would display 2022 as $20.22.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      Would you have to convert from one currency to another if the symbol in the file weren't 'R'?

      Comment

      Working...