简体   繁体   中英

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 (eg 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM