matteodv
matteodv

Reputation: 3982

What is the best way to manage number with currency?


In my application it's possible to store a price for every object and the user can also choose its preferred currency.
What is the best way to store and manage number with currency in iPhone SDK?

More infos about my app:
It uses Core Data.
Number that can be stored must be of type xxx.xx (e.g. 100.00).
How can I sort these numbers ascending or descending?
What kind of attribute I must set in my entity to store a number like this?

Have you got links, docs, source or guides to show me examples? I never user number with currency, then I've got some problems with them :)

Thanks a lot,
Matthew

Upvotes: 0

Views: 720

Answers (1)

Robert
Robert

Reputation: 6540

Store it in GP (gold pieces) with a conversion factor ;)

It doesn't look like there's a datatype for currency, so storing the number and decimal part, and a setting for the current currency, is probably as good as you're going to get. See this: HowTo for newbie: Managing currency in iPhone app

Upvotes: 2

Related Questions