Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用适用于 iOS 的Realm.io数据库。我正在创建一个RLMObject,它只支持NSInteger, CGFloat, int, long, float, and double数字但不支持NSDecimalNumber。我考虑过使用 adouble但发现它有舍入误差,小于 a float,但它仍然有它们。存储货币的最佳方式是什么?
NSInteger, CGFloat, int, long, float, and double
NSDecimalNumber
double
float
您的选择之一是使用 NSString 进行存储。您需要做的基本概述是:
当你想取回它时,你会拉动物体,这样你就可以再次拿回你的绳子,然后你需要运行+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)numericString这会引导你回到你的价值
+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)numericString