[英]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? 在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). 可以存储的数字必须为xxx.xx类型(例如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 ;) 将其存储在具有转换因子的GP(金币)中;)
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 请参阅: 新手入门指南:在iPhone应用程序中管理货币
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.