0

xcode 可以使用 Decimal 3 位吗?

例子:

NSDecimal *test = 1.0.0; //not work
double test = 1.0.0; //not work
float test = 1.0.0; //not work

我可以在 xcode 中使用小数点 3 位吗?

4

2 回答 2

0

版本号1.0.3既不是浮点数也不是十进制数。如果您需要将它们存储在变量中,请使用字符串:

NSString *test = @"1.0.0";
于 2013-09-16T03:42:35.333 回答
0

使用字符串和componentsSeparatedByString:方法,然后将数组中的每个对象转换为适当的格式。

于 2013-09-16T03:47:01.483 回答